How to Convert Json to Object in C#

后端 未结 1 770
名媛妹妹
名媛妹妹 2021-01-29 13:00

I want Convert Json to Object in C#. Json here is:

[{\"value\":\"e920ce0f-e3f5-4c6f-8e3d-d2fbc51990e4\"}].

How to do it using Object.

Question seems sil

1条回答
  •  一生所求
    2021-01-29 13:33

    Using NewtonSoft Json.NET library (https://www.newtonsoft.com/json), you can do as follows:

    JObject result = JObject.Parse(jsonString);
    

    But your Json string looks more like an array, so probably JArray.Parse is what you need to use instead. Documentation with examples here:

    https://www.newtonsoft.com/json/help/html/ParseJsonArray.htm

    If you want to parse the internal elements as objects, thhe accepted answer of this question should provide you enough hints:

    C# Parsing JSON array of objects

    0 讨论(0)
提交回复
热议问题