Parsing Json into a dynamic c# object with a dynamic key -


i'm trying parse google calendar response i'm getting rest api using c#, seem keep getting stuck. [edited] update, @ symbol isn't preventing drill down, verified replacing @ _at_. see screenshot of quick watch: enter image description here

i'm sure i'm accessing incorrectly...

here's jsonstring i'm trying parse:

{  "kind": "calendar#freebusy",  "timemin": "2015-06-12t14:00:00.000z",  "timemax": "2015-06-14t14:00:00.000z",  "calendars": {   "joe@bobs.com": {    "busy": [     {      "start": "2015-06-13t18:30:00z",      "end": "2015-06-13t19:30:00z"     },     {      "start": "2015-06-13t20:30:00z",      "end": "2015-06-13t21:30:00z"     },     {      "start": "2015-06-13t23:00:00z",      "end": "2015-06-14t00:00:00z"     }    ]   }  } } 

i've tried using:

dynamic myobj = json.decode(jsonstring); 

and

var myobj = jsonconvert.deserializeobject(jsonstring); 

but can't figure out how joe@bobs.com key (which dynamic based on send up) cycle through busy times.

ideas?

enter image description here

you can access via string indexer:

var myobj = jsonconvert.deserializeobject<dynamic>(jsonstring); console.writeline(myobj.calendars["joe@bobs.com"]); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

php - Find a regex to take part of Email -

javascript - Function overwritting -