Parse JSON String to JSON Object in C#.NET

前端 未结 4 1373
逝去的感伤
逝去的感伤 2020-12-06 04:31

I have a JSON String returned by my SOAP web service in .NET. It is as follows:

{
 \"checkrecord\":
   [
     {
      \"rollno\":\"abc2\",
      \"percentage         


        
4条回答
  •  [愿得一人]
    2020-12-06 04:53

    Another choice besides JObject is System.Json.JsonValue for Weak-Typed JSON object.

    It also has a JsonValue blob = JsonValue.Parse(json); you can use. The blob will most likely be of type JsonObject which is derived from JsonValue, but could be JsonArray. Check the blob.JsonType if you need to know.

    And to answer you question, YES, you may replace json with the name of your actual variable that holds the JSON string. ;-D

    There is a System.Json.dll you should add to your project References.

    -Jesse

提交回复
热议问题