Deserializing nested json object c# -


this question exact duplicate of:

i have nested json object, this,

  "where": {       "operator": "and",       "left": {         "operator": "=",         "$fieldref": "requestor",         "value": "@me"       },       "right": {         "operator": "=",         "$fieldref": "state",         "value": "closed"       }     }, 

i deserialize in c#, problem object can more larger depending on user, object can follows,

and this,

"where": {       "operator": "or",       "left": {         "operator": "startswith",         "$fieldref": "id"       },       "right": {         "operator": "or",         "left": {           "operator": "startswith",           "$fieldref": "orgid"         },         "right": {           "operator": "and",           "left": {             "operator": "startswith",             "$fieldref": "firstname"           },           "right": {             "operator": "startswith",             "$fieldref": "lastname"           }         }       }     }, 

please consider using popular library this: json.net

then can use built in visual studio parse tool json classes found found under: edit -> paste special -> paste json classes. generate classes needed json.

once you've added reference json.net can run following deserialize:

rootobject deserialized = jsonconvert.deserializeobject<rootobject>(jsonstring); 

were "rootobject" top class json structure.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -