I am using .Net 6 WebAPI. I need to accept a generic JSON array as input. The properties present in each JSON document is not known before. So I cannot Deserialize to specific object type. So I am looking for 2 inputs. a) What should be input datatype to accept this in body, when using System.Text.Json? Previously, we have used JArray using JSON.NET. b) How can I then read this input as an array so that I can then convert into generic JsonObject type?
[
{ "prop1" : "value1", "prop2" : "value1"},
{ "prop3" : "value3", "prop4" : "value4"},
{ "propx" : "valuex", "propy" : "value6", "nested": { "other": [1,23,45] }}
]
I am also open to option of accepting NDJSON.
Thanks!