I am writing a program to read a JSON string from Podio, and then convert the contents to c# objects.
But while reading the feed, I came across a strange format; At the same hierarchy-level of object, sometimes the value of the field [value] is a string but other times it is a complex object.
Example is below.
At some places it is like
"values":[
{
"value":"Bug on User Interface, Ajax sometimes does not load properly"
}
],
"type":"text"
and then at the next item, at the same level in the hierarchy, it is like
"values":[
{
"value":{
"perma_link":"https:\/\/ds-test.podio.com\/myworkspace\/files\/23529948",
"mimetype":"image\/jpeg",
"hosted_by":"podio",
"name":"217820_274164679355286_689330144_n.jpg",
"hosted_by_humanized_name":"Podio",
"description":null,
"thumbnail_link":"https:\/\/files.podio.com\/23529948",
"link":"https:\/\/files.podio.com\/23529948",
"file_id":23529948,
"size":39698
}
}
],
"type":"image"
Note the value of "type": For the first instance it is "text" and then for the next it is "image". As they are on the same level of the hierarchy, I have no idea how to design the objects for them so that the DataContractJsonSerializer.Read
method works smoothly.
Regards,