I am trying to loop through the list of JSON objects and convert them into indexed JSON.
Below is the code I have written:
private string ItemsAsJson(List<string> jsonItemList)
{
string ItemAsJson = "";
for (int i = 0; i < jsonItemList.Count; i++)
{
string index = i.ToString();
ItemAsJson += "{ " + index + " : " + jsonItemList[i] + "},";
}
return ItemAsJson;
}
But I get the object as below here:
{
0: {
"item_type": "Batch",
"item_id": "82",
"bill_item_name": "A TO Z",
"quantity": "1",
"inventory_id": "82",
"individual_price": "2.90",
"batch_no": "",
How do I convert the 0 in the above text to string ("0")?