简体   繁体   中英

JSON ARRAY to JSON Object in c#

Hi I am new to c# and I want to change a JSON Array into one single JSON Object. Can anyone help me out here?

Here is my JSON Array:

[ { "A": { "type": "string", "defaultValue": "autogenerated" }, "B": { "type": "string", "defaultValue": "autogenerated" }, "C": { "type": "dropdown", "dropDownItems": [ "true", "false" ], "defaultValue": "false" } } ]

And this is my expected output: { "A": { "type": "string", "defaultValue": "autogenerated" }, "B": { "type": "string", "defaultValue": "autogenerated" }, "C": { "type": "dropdown", "dropDownItems": [ "true", "false" ], "defaultValue": "false" } }

Logically it is impossible to convert an array with multiple elements to an object.

However, if your example is your current scenario. You may just take the first element in the array as an object.

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