Solved

JSON.NET Deserialisation not able to retrieve some data

Posted on 2014-03-29
1
295 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 70

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

773 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