I am working with an API that returns an array of "entries" records.
I would like to create a class definition that can be used to deserialize the entire json object.
I am hoping a library that would support this exists, I only tagged json.net as I have worked with it in the past. I'm open to anything.
One of the properties in each entry has a name that represents a consistent data structure, but has a different name each time. The property name does have a format that would easily be matched by a regular expression if that helps.
The property in question here is
"https://bi.com/biprws/v1/documents/1"
Where the trailing "/1" represents an id which will change with each record, and there will be property names like
"https://bi.com/biprws/v1/documents/1"
"https://bi.com/biprws/v1/documents/123"
"https://bi.com/biprws/v1/documents/12345"
etc
The json returned by the API with just a single record for brevity
"entries": [
{
"https://bi.com/biprws/v1/documents/1": {
"__deferred": {
"uri": "https://bi.com/biprws/v1/documents/1"
}
},
"cuid": "x",
"name": "x",
"description": "",
"id": "1",
"type": "x",
"ownerid": "1",
"updated": "Jan 01, 2023 00:07 AM",
"parentid": "1"
},
]
I believe that my question is different than the one linked to this by a moderator, as the data schema is more complicated.
This post suggested by dbc in the comments was helpful to me. How to deserialize a child object with dynamic (numeric) key names?
It doesn't fully work as it fails to properly populate the value of the dynamic property, so its not necessarily going to be helpful to everyone, but in my case the dynamic property name is enough for me to work with.