feat: add JSON converters for JsonElement, JsonObject, and JsonArray#20
feat: add JSON converters for JsonElement, JsonObject, and JsonArray#20IvanMurzak merged 13 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for serializing and deserializing JsonElement, JsonObject, and JsonArray types by introducing dedicated JSON converters with schema generation capabilities.
Key Changes:
- Implemented three new JSON converters (
JsonElementJsonConverter,JsonObjectJsonConverter,JsonArrayJsonConverter) with JSON schema support - Created abstract base class
JsonNodeJsonConverter<T>to share common serialization logic forJsonNode-derived types - Registered the new converters in
JsonSerializerto enable their use throughout the system
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| JsonSerializer.cs | Registers the three new JSON converters in the serializer's constructor |
| JsonNodeJsonConverter.cs | Provides abstract base implementation for reading/writing JsonNode types with null handling |
| JsonElementJsonConverter.cs | Implements converter for JsonElement with schema generation |
| JsonObjectJsonConverter.cs | Implements converter for JsonObject with schema generation |
| JsonArrayJsonConverter.cs | Implements converter for JsonArray with schema generation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…cy on JsonDocument
… and StartArray token types
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…lable return types for CreateJsonNode method
This pull request introduces new JSON converters for handling
JsonElement,JsonObject, andJsonArraytypes, and integrates them into theJsonSerializer. The converters provide schema support and proper serialization/deserialization logic for these types, improving the flexibility and standards-compliance of JSON handling in the project.New JSON Converter Implementations:
JsonElementJsonConverterto handle conversion and schema generation forJsonElementobjects, including support for null values and writing logic.JsonObjectJsonConverterto handle conversion and schema generation forJsonObjectobjects, with logic for creating nodes from elements.JsonArrayJsonConverterto handle conversion and schema generation forJsonArrayobjects, supporting array items and references.JsonNodeJsonConverter<T>to encapsulate common logic for reading and writingJsonNode-derived types, including null handling and error reporting.Integration:
JsonSerializerconstructor to ensure they are used in serialization and deserialization processes.