art-a-game
art-a-game

Reputation: 133

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" } }

Upvotes: 0

Views: 195

Answers (1)

skyxanxus
skyxanxus

Reputation: 81

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.

Upvotes: 1

Related Questions