Solved

JSON.NET Deserialisation not able to retrieve some data

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This is about my first experience with programming Arduino.
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 …
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…

760 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