简体   繁体   中英

How to make json to json object in c#?

I have a json wants to add square brackets on it (means wants to convert it to json object array) 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 as below (Just square brackets before and to the end of the json)

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

Apart from concatenation is there any way to achieve this ? And this is a JObject which i have created.

JArray []表示正在返回一个数组而不是一个对象,因此您需要将外部容器设为JArray

var returnedArray = new JArray(jObject);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM