Solved

JSON.NET Deserialisation not able to retrieve some data

Posted on 2014-03-29
1
294 Views
Last Modified: 2014-03-29
Hi all,

I have some Json which is successfully serialised using the following...
MyObj.Root deserializedMe= JsonConvert.DeserializeObject<MyObj.Root>(json);

Open in new window


It works very well until I get to the place where there is a further level without any title/name for the fields. Soemthing like the following.

MYGROUP":{"123":"HELPDESK"}

Open in new window


So MYGROUP can have as many items as possible. So I need some sort of list object with two variables. I keep getting a big JSON error and wondered if any someone could point me in the right direction.

So I have this...
 
public class MyObj
    {    
public class Root
        {
            public List<MYGROUP> MyGroups{ get; set; }
public class MYGROUP
        {
            string groupId { get; set; }
            public string name { get; set; }

        }}}

Open in new window


Its a toughy, so close to finally resolving all of this. Thanks in advance for any advice.
0
Comment
Question by:meetsys
1 Comment
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 39963782
the best trick I can give you is to serialize an instantiated and filled object with your classes and look at the generated string.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now