So, firstly, I cannot use 'dynamic' as this is ultimately going through a IL2CPP transpiler that doesn't support dynamic language runtime (DLR).
That said, I'm writing a client intended for other developers to use that consumes a very generic API that allows for, including other things, defining/updating properties whose value can be any valid JSON type (string, number, array, nested object) as well as listing out all the properties that exist and their values. The following array elements could conceivably be modified during runtime of the application. I'm trying to figure out the most ergonomic way to deserialize something like the following in C#:
[
{
"_id": "43534253"
"value": {
"name": "named thing",
"address": [
"Address Line 1",
"Address Line 2"
],
"location": {
"lat": 50.123456,
"long": -78.34
}
}
},
{
"_id": "2345324",
"value": {
"a": "hello world",
"b": 188.40723030755805,
"c": 260
}
},
...
]
To be clear, a further constraint however is that these are not the only two value types for "value". This array is the result of requesting "all the variously typed properties you've created through an API and their values". A devs next call may be to create a new property with
value: 0
which would add a third element to the above array with a value that is a number.