I have a JSON file and one of the values is represented as a list of integers, but I would like to convert the list to nested JSONS with its value and surrogate key (autoincrement from 1 for each list).
Is it possible to use Newtonsoft.json.dll for this task?
This is actual example
{
"content": {
"table": [
{
"name": {
"en": "questionnaire"
},
"data": [
"154",
"124254",
"87575"
]
}
]
}
}
This is needed output:
{
"content": {
"table": [
{
"name": {
"en": "questionnaire"
},
"data": [
{
"id": "1",
"value": "154"
},
{
"id": "2",
"value": "124254"
},
{
"id": "3",
"value": "87575"
}
]
}
]
}
}
Thank you very much for any ideas.

JArray,JObjectand other classes from Newtonsoft.Json. Or you can use Newtonsoft.Json to deserialize the original Json into objects of a class structure that matches the original Json layout, then process the data in your program based on those objects and construct another model/object tree based on (other) classes matching your desired new Json layout, and then finally serialize this back to json.