Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Arrays in SystemText #44

Merged
merged 5 commits into from
Feb 3, 2025
Merged

Fix Arrays in SystemText #44

merged 5 commits into from
Feb 3, 2025

Conversation

Morcatko
Copy link
Owner

@Morcatko Morcatko commented Jan 5, 2021

No description provided.

@@ -14,25 +15,23 @@ private static object ToObject(this JsonElement jsonElement)
case JsonValueKind.Null: return null;
case JsonValueKind.String: return jsonElement.GetString();
case JsonValueKind.Number: return jsonElement.GetGenericNumber();
case JsonValueKind.Array: return jsonElement.EnumerateArray().Select(j => j.ToObject()).ToArray();

Choose a reason for hiding this comment

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

Leads to an exception when an array contains complex objects. When ToObject is called with such array element, it throws NotSupportedException.

Choose a reason for hiding this comment

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

Did any of you manage to make some progress with this?
@OleksandrHorbunovVP what was the end solution that you used?
Currently working on a project where this would be useful but immediately hit this problem.

@caleidon
Copy link
Contributor

caleidon commented Feb 2, 2025

@Morcatko Can you please merge this? Currently, without this, you are completely unable to use [] or List in PATCH DTOs because the following exception occurs:

"Unsupported ValueKind - Array"

It seems your fix may at least work with primitive types which is more than enough in most cases.

@Morcatko Morcatko merged commit b72d73a into master Feb 3, 2025
1 check failed
@Morcatko Morcatko deleted the SystemTextArrays branch February 3, 2025 07:26
@Morcatko
Copy link
Owner Author

Morcatko commented Feb 3, 2025

This will be part of 6.0.3 version. It fixes primitive types only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants