Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to do something like this:

C#
JavaScriptSerializer js = new JavaScriptSerializer();
Session["token"] = js.Deserialize<dynamic>(HtmlResult)[0];


My variable HtmlResult Contains Json Object and have three fields.

HTML
{
  "access_token": "0mlMO3RHjFN0DzUzIyok7XhOHXAj-J1id-dnL1rFQF9aWr4DJxCB1u9pd6LI7NkAIzf8qKKeDP-kN-Uk5ND-rsSoNUtlB1lZxGGx7ytVa2CoJdd1iZzHxJLkLXJep481AbeT1iyU45kjj8IaldIghREBTgGqjBrX9U0MpHy455Ac_hO6O0t78wXGl0AIjxWKt3N7cfpXE-Thhirda75Sd5ogiODc-p85Rtw76w61Lsc",
  "token_type": "bearer",
  "expires_in": 86399
}


I want to access only the first and second field i.e. access_token and token_type and store them in variable seprately only if the return Json data has these three property . how i can do it.
Posted
Updated 16-Aug-15 21:00pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900