G
G
GetB2014-09-13 22:27:19
JSON
GetB, 2014-09-13 22:27:19

How to deserialize JSON into a C# class if the class must have a number name?

JSON example:

{
    "status": "ok",
    "count": 1,
    "data": {
        "10663586": {
            "achievements": {

            },
            "client_language": "ru",
            "statistics": {
                "clan": {

                },
                "all": {

                },
                "max_xp": 2236,
                "company": {

                },
                "historical": {

                },
                "max_damage": 5852,
                "max_damage_vehicle": 7169
            },

        }
    }
}

C# example:
public class Achievements
{
    
}

public class Clan
{
    
}

public class All
{
    
}

public class Company
{
    
}

public class Historical
{
    
}

public class Statistics
{
    
}

public class __invalid_type__10365588
{
    
}

public class Data
{
    public __invalid_type__10365588 __invalid_name__10365588 { get; set; }
}

public class RootObject
{
    public string status { get; set; }
    public int count { get; set; }
    public Data data { get; set; }
}

The problem lies in the class named __invalid_type__10365588.
Perhaps there is some functionality in JSON.NET that I don't know about, but it will fix this problem.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
easyman, 2014-09-13
@GetB

Use dynamic

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question