In documentdb I have some json structure.
{ "blah": "blahblahblah",
"blah": null,
"dynamicBlah": {
"propertyhere": [
"xyz"
]
},
}
In my c# model that this deserializes into an object just fine EXCEPT The dynamicBlah object is there as a JObject but its when returned as a JSONResult to the client (serialized again) that property just comes out like this...
"dynamicBlah": [
[
[
[]
]
]
]
A few things:
- The purpose of that property is just to pass through any custom json in the record so the type could be anything so it must be a dynamic or object type.
- I can't just deserialize it to a string because some C# may need to access that object and it'd be a pain to have to constantly convert it to json and back
- I know Json.net can serialize/deserialize objects and dynamics because I've done it elsewhere with no issue. However there's something about getting it from document db that makes the serializer ignore the sub properties of the dynamic.
- yes I've tried marking it [JsonProperty]
- yes I've tried it as both dynamic and object
- Json.net obviously recognizes there's somthing there because it outputs multiple empty levels of json.
- this happens when the object is both an object and a collection
Can anyone tell me how to get Json.net to not ignore the sub properties? The end result should be the same json structure is it is in documentdb.
UPDATE:
No making it a Dictionary doesnt work since that only types the top level so I end up with
"dynamicBlah": {"xyz": [
[]
]
}
When xyz would be another object or a list of strings or anything at all...