JSON.NET deserialize a specific property

前端 未结 6 2211
时光说笑
时光说笑 2020-11-30 07:36

I have the following JSON text:

{
    \"PropOne\": {
        \"Text\": \"Data\"
    }
    \"PropTwo\": \"Data2\"
}    

I want

6条回答
  •  醉话见心
    2020-11-30 08:01

     var json = "{ "PropOne": { "Text": "Data" } "PropTwo": "Data2" }";
    
     JObject o = JObject.Parse(json);
     var val = o.PropTwo;
    

    Using JSON Linq provider you do not need to deserialize the object into a known type.

提交回复
热议问题