Tornhoof / SpanJson

SpanJson is a JSON serializer for .NET Core 6.0+
MIT License
424 stars 41 forks source link

JsonObject Equivalent #219

Closed YogiCoder8888 closed 4 days ago

YogiCoder8888 commented 4 days ago

Does SpanJson have a generic Json object class equivalent to System.Text.Json.Nodes.JsonObject?

If not, is it possible to Serialize System.Text.Json.Nodes.JsonObject using SpanJson library?

I tried the following code and get an "System.InvalidOperationException: 'Nesting Limit of 256 exceeded." exception

var x = new JsonObject() { { "test", 1} }; var y = JsonSerializer.Generic.Utf16.Serialize(x);

Thank you.

Tornhoof commented 4 days ago

No, there is no DOM Style API in SpanJson, there is limited support for dynamic (ExpandoObjects). I personally would not recommend using dynamic. Serializing things like JsonObject is not supported.