locked
Convert JsonCovert.DeserializeObject to JsonObject in Windows phone 8.1

    Question

  • Hi , 

    Please have a look on the following code :

     HttpClient client = new HttpClient();
                var response = await client.GetAsync(new Uri(url));
                string result = await response.Content.ReadAsStringAsync();
    
                var obj1 = JsonConvert.DeserializeObject(result);
                JsonObject resultJson = (JsonObject) obj1;

    Breakpoints only hit till obj1 is declared when i parse the obj1 to JsonObject that breakpoint line doenst hit. 

    How i can covert the JsonConvert.DeserializeObject result to JsonObject.

    Thanks


    Thank You , Shan Ali Khan

    Monday, October 6, 2014 4:37 AM

All replies

  • Isn't result already a JSONObject?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, October 6, 2014 7:08 PM
    Moderator
  • obj1 type is .net object.

    while the last line dont hit the breakpoint. still unable to cast .net object obj1 to jsonobject


    Thank You , Shan Ali Khan

    Monday, October 6, 2014 8:11 PM
  • If you can't cast it, you may have to break it open and transform it yourself. Where does "JSONObject" come from?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, October 7, 2014 1:07 PM
    Moderator