How can i create a Json array from a group of arrays

I want to create the below json array from a group of arrays what would be the best way to go about this. i tried a for each loop but it overwrites the first instance.

“CompaniesInfo”: [
{
“CompanyId”: 138,
“CompanyInfo”: {
“Score”: “123”,
“DocumentKey”: “76149”,
“DocumentUrl”: “Test .pdf”,
“IsSuccess”: “”,
“Comment”: “”
}
},
{
“CompanyId”: 139,
“CompanyInfo”: {
“Score”: “456”,
“DocumentKey”: “76149c7b”,
“DocumentUrl”: “Test df”,
“IsSuccess”: “”,
“Comment”: “”
}
}
]

Have you used Deserialize Json array @duaine.b ?

image

Regards
Sudharsan

Hi i wanted to create the Json array using the array value. Because the json array doesn’t exist i can’t reserialise

Okay @duaine.b

Checkout this Video and the thread for multiple suggestions you can try this

Regards
Sudharsan

Hi @duaine.b

You can try this approach

dictCompanyInfo = New Dictionary(Of String, Object) From {{"Score", in_arrayScore(indx).ToString}, {"DocumentKey", in_arrayDocumentKey(indx).ToString}, {"DocumentUrl", in_strDocumentUrl}, {"IsSuccess", in_arrayIsSuccess(indx).ToString}, {"Comment", in_arrayComment(indx).ToString}}

xaml for reference
JSON_ArrayToJSONArray.xaml (12.6 KB)

CAUTION: take care of the index out of range exception