RuntimeBinderException when parsing json with Newtonsoft.Json

前端 未结 3 1494
忘掉有多难
忘掉有多难 2021-01-14 06:09

I\'m trying to parse simple json to dynamic object in Windows phone 8. I\'m using Newtonsoft.JSON library with this code:

dynamic response = JObject.Parse(re         


        
相关标签:
3条回答
  • 2021-01-14 06:40

    The value that you're seeing is the ToString() value. What you're looking for is:

    response["_links"]
    

    For a full example see: http://james.newtonking.com/projects/json/help/html/ModifyJson.htm

    0 讨论(0)
  • 2021-01-14 06:58

    I was hitting something similar in VS 2015. The approach using [] to access the properties works, however if I enable "Just My Code" in Tools > Options > Debugging > General. I was able to use the properties on the dynamic objects as normal e.g. code like: response._links.streams; worked.

    See this other post with a similar question

    0 讨论(0)
  • 2021-01-14 07:04

    Yes, you are not alone, I also faced similar issue ( without hangover ;P )

    I just modified the file for a space or line and rebuild the entire solution, started working fine in debug mode also...

    Happy Holidays!

    0 讨论(0)
提交回复
热议问题