none
How to deserialize a dictionary using DataContractJsonSerializer (Framework 3.5)?

    Question

  • Hello All,

    Is there a way to convert a Json string to a dictionary (String, List(of UserDefinedClass))? 

    I have the following Json response:

    {
      "orders": {
        "4": [
          {
            "childs": [
              {
                "childs": [
                  {
                    "childs": [
                      {
                        "childs": [
                         
                        ],
                        "menuRelation": "item",
                        "title": "Absolut Vodka",
                        }
                    ],
                    "menuRelation": "family",
                    "title": "Wine"
                  }
                ],
                "menuRelation": "family",
                "title": "Drinks"
              }
            ],
           "menuRelation": "family",
            "title": "MENU"
          }
        ]
      }
    }

    I've already created a class to be filled by the json string, but my outer class has a variable of type

    Dictionary(Of String, List(of ClassMenu))

    Is there a way to deserialize json string to Dictionary using framework 3.5 instead of using JavaScriptSerializer?

    Thanks

    Thursday, July 18, 2013 5:53 PM

All replies

  • Hi Kartman_k2,

    There is a similar thread with yours,you can have a look at the following link

    Click Here

    Please let me know it works or not.


    ALL FOR ONE AND ONE FOR ALL.

    Monday, July 22, 2013 9:34 AM
  • I've seen that thread before posting mine.

    My problem is that JsonArray only exists in Framework 4.5 and Silverlight and I need a solution for Framework 3.5.

    Thank's anyway.

    Monday, July 22, 2013 9:45 AM