Skip to content

feat: add JSON converters for JsonElement, JsonObject, and JsonArray#20

Merged
IvanMurzak merged 13 commits intomainfrom
feature/json-schema-for-json-classes
Oct 23, 2025
Merged

feat: add JSON converters for JsonElement, JsonObject, and JsonArray#20
IvanMurzak merged 13 commits intomainfrom
feature/json-schema-for-json-classes

Conversation

@IvanMurzak
Copy link
Copy Markdown
Owner

This pull request introduces new JSON converters for handling JsonElement, JsonObject, and JsonArray types, and integrates them into the JsonSerializer. 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:

  • Added JsonElementJsonConverter to handle conversion and schema generation for JsonElement objects, including support for null values and writing logic.
  • Added JsonObjectJsonConverter to handle conversion and schema generation for JsonObject objects, with logic for creating nodes from elements.
  • Added JsonArrayJsonConverter to handle conversion and schema generation for JsonArray objects, supporting array items and references.
  • Introduced a shared abstract base class JsonNodeJsonConverter<T> to encapsulate common logic for reading and writing JsonNode-derived types, including null handling and error reporting.

Integration:

  • Registered the new converters in the JsonSerializer constructor to ensure they are used in serialization and deserialization processes.

@IvanMurzak IvanMurzak requested a review from Copilot October 23, 2025 09:37
@IvanMurzak IvanMurzak self-assigned this Oct 23, 2025
@IvanMurzak IvanMurzak added the enhancement New feature or request label Oct 23, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for JsonNode-derived types
  • Registered the new converters in JsonSerializer to 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.

Comment thread ReflectorNet/src/Convertor/Json/JsonNodeJsonConverter.cs Outdated
Comment thread ReflectorNet/src/Convertor/Json/JsonObjectJsonConverter.cs Outdated
Comment thread ReflectorNet/src/Convertor/Json/JsonArrayJsonConverter.cs Outdated
Comment thread ReflectorNet/src/Convertor/Json/JsonElementJsonConverter.cs Outdated
IvanMurzak and others added 4 commits October 23, 2025 02:37
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>
@IvanMurzak IvanMurzak requested a review from Copilot October 23, 2025 09:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ReflectorNet/src/Convertor/Json/JsonArrayJsonConverter.cs Outdated
Comment thread ReflectorNet/src/Convertor/Json/JsonElementJsonConverter.cs Outdated
IvanMurzak and others added 3 commits October 23, 2025 02:40
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@IvanMurzak IvanMurzak requested a review from Copilot October 23, 2025 09:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ReflectorNet/src/Convertor/Json/JsonElementJsonConverter.cs Outdated
Comment thread ReflectorNet/src/Convertor/Json/JsonNodeJsonConverter.cs Outdated
@IvanMurzak IvanMurzak requested a review from Copilot October 23, 2025 09:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ReflectorNet/src/Convertor/Json/JsonObjectJsonConverter.cs Outdated
Comment thread ReflectorNet/src/Convertor/Json/JsonArrayJsonConverter.cs Outdated
@IvanMurzak IvanMurzak merged commit f2aaeba into main Oct 23, 2025
1 check passed
@IvanMurzak IvanMurzak deleted the feature/json-schema-for-json-classes branch October 23, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants