Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8817255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:48:06+00:00 2026-06-14T04:48:06+00:00

My JSON feed has nested objects like this: { id: 1765116, name: StrozeR, birth:

  • 0

My JSON feed has nested objects like this:

{
"id": 1765116,
"name": "StrozeR",
"birth": "2009-08-12",
"avatar": "http:\/\/static.erepublik.com\/uploads\/avatars\/Citizens\/2009\/08\/12\/f19db99e9baddad73981d214a6e576ef_100x100.jpg",
"online": true,
"alive": true,
"ban": null,
"level": 61,
"experience": 183920,
"strength": 25779.42,
"rank": {
    "points": 133687587,
    "level": 63,
    "image": "http:\/\/www.erepublik.com\/images\/modules\/ranks\/god_of_war_1.png",
    "name": "God of War*"
},
"elite_citizen": false,
"national_rank": 6,
"residence": {
    "country": {
        "id": 81,
        "name": "Republic of China (Taiwan)",
        "code": "TW"
    },
    "region": {
        "id": 484,
        "name": "Hokkaido"
    }
}
}

and my object classes are like this:

class Citizen
{
    public class Rank
    {
        public int points { get; set; }
        public int level { get; set; }
        public string image { get; set; }
        public string name { get; set; }
    }
    public class RootObject
    {
        public int id { get; set; }
        public string name { get; set; }
        public string avatar { get; set; }
        public bool online { get; set; }
        public bool alive { get; set; }
        public string ban { get; set; }
        public string birth { get; set; }
        public int level { get; set; }
        public int experience { get; set; }
        public double strength { get; set; }
        public List<Rank> rank { get; set; }

    }
}

I try to parse my JSON data with following code

private async void getJSON()
{
    var http = new HttpClient();
    http.MaxResponseContentBufferSize = Int32.MaxValue;
    var response = await http.GetStringAsync(uri);

    var rootObject = JsonConvert.DeserializeObject<Citizen.RootObject>(response);
    uriTB.Text = rootObject.name;
    responseDebug.Text = response;
}

but I get the following error:

Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Erepublik.Citizen+Rank]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.

I can’t even parse the value in the main object. Anyway to fix this? and how can I parse a value inside of a nested object? for example: “points” in “rank”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:48:07+00:00Added an answer on June 14, 2026 at 4:48 am

    Like the error message says, your rank property in the .NET class is a List<Rank>, but in your JSON it’s just a nested object, not an array. Change it to just a Rank instead of a List<Rank>.

    Arrays in JSON (or any Javascript, really) are enclosed in []. The {} characters specify a single object. The CLR type has to roughly match the JSON type in order to deserialize. Object to object, array to array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a json feed from this URL which contains 20 fields and I
For example, here's a 'page': http://www.facebook.com/facebook That page has an RSS feed (which I'd
Following directie code is from http://jsfiddle.net/M6RPn/26/ I want to get a json feed that
I have a mapView that has annotation added through JSON (feed is stored in
The site http://openbook.etoro.com/#/main/ has an live feed what is generated by javascript via XHR
I have a JSON feed that is pulling into an each statement. What I
I'm parsing a json feed routinely and need to insert only the newest users
My project uses a JSON feed to grab info about earthquakes within a specified
I have a JSON feed (which I don't directly control, I have to ask
I have a JSON feed data with lots of user relation in it such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.