How to make json for a json object in c #?

I have json that wants to add square brackets to it (which means it wants to convert it to an array of json objects) here is my json in response,

    {
  "exampleJson": {
    "test": [
      {
        "xf": "G",
        "sas": "24",
        "ras": 5,
        "asd": 4000,
        "rer": 200,
        "asda": 0
      },
    ],
  }
}  

Now I want this json to be lower (only square brackets before and to the end of json)

    [{
  "exampleJson": {
    "test": [
      {
        "xf": "G",
        "sas": "24",
        "ras": 5,
        "asd": 4000,
        "rer": 200,
        "asda": 0
      },
    ],
  }
}]

Besides concatenation, is there any way to achieve this? And this JObjectis what I created.

+4
source share
1 answer

The surrounding []indicates that the array is returned, not the object, so you need to make an external container JArray:

var returnedArray = new JArray(jObject);
+3
source

Source: https://habr.com/ru/post/1673476/


All Articles