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

  • SEARCH
  • Home
  • 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 8114373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:07:37+00:00 2026-06-06T03:07:37+00:00

Here is my simple User POCO class: /// <summary> /// The User class represents

  • 0

Here is my simple User POCO class:

/// <summary>
/// The User class represents a Coderwall User.
/// </summary>
public class User
{
    /// <summary>
    /// A User's username. eg: "sergiotapia, mrkibbles, matumbo"
    /// </summary>
    public string Username { get; set; }

    /// <summary>
    /// A User's name. eg: "Sergio Tapia, John Cosack, Lucy McMillan"
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// A User's location. eh: "Bolivia, USA, France, Italy"
    /// </summary>
    public string Location { get; set; }

    public int Endorsements { get; set; } //Todo.
    public string Team { get; set; } //Todo.

    /// <summary>
    /// A collection of the User's linked accounts.
    /// </summary>
    public List<Account> Accounts { get; set; }

    /// <summary>
    /// A collection of the User's awarded badges.
    /// </summary>
    public List<Badge> Badges { get; set; }

}

And the method I’m using to deserialize a JSON response into a User object (this actual JSON call is here):

private User LoadUserFromJson(string response)
{
    var outObject = JsonConvert.DeserializeObject<User>(response);
    return outObject;
}

This fires an exception:

Cannot deserialize the current JSON object (e.g. {“name”:”value”})
into type
‘System.Collections.Generic.List`1[CoderwallDotNet.Api.Models.Account]’
because the type requires a JSON array (e.g. [1,2,3]) to deserialize
correctly.

To fix this error either change the JSON to a JSON array
(e.g. [1,2,3]) or change the deserialized type so that it is a normal
.NET type (e.g. not a primitive type like integer, not a collection
type like an array or List) that can be deserialized from a JSON
object. JsonObjectAttribute can also be added to the type to force it
to deserialize from a JSON object. Path ‘accounts.github’, line 1,
position 129.

Having never worked with this DeserializeObject method before, I’m kind of stuck here.

I’ve made sure that the property names in the POCO class are the same as the names in the JSON response.

What can I try to deserialize JSON into this POCO class?

  • 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-06T03:07:38+00:00Added an answer on June 6, 2026 at 3:07 am

    Here is a working example.

    Keypoints are:

    • Declaration of Accounts
    • Use of JsonProperty attribute

    .

    using (WebClient wc = new WebClient())
    {
        var json = wc.DownloadString("http://coderwall.com/mdeiters.json");
        var user = JsonConvert.DeserializeObject<User>(json);
    }
    

    –

    public class User
    {
        /// <summary>
        /// A User's username. eg: "sergiotapia, mrkibbles, matumbo"
        /// </summary>
        [JsonProperty("username")]
        public string Username { get; set; }
    
        /// <summary>
        /// A User's name. eg: "Sergio Tapia, John Cosack, Lucy McMillan"
        /// </summary>
        [JsonProperty("name")]
        public string Name { get; set; }
    
        /// <summary>
        /// A User's location. eh: "Bolivia, USA, France, Italy"
        /// </summary>
        [JsonProperty("location")]
        public string Location { get; set; }
    
        [JsonProperty("endorsements")]
        public int Endorsements { get; set; } //Todo.
    
        [JsonProperty("team")]
        public string Team { get; set; } //Todo.
    
        /// <summary>
        /// A collection of the User's linked accounts.
        /// </summary>
        [JsonProperty("accounts")]
        public Account Accounts { get; set; }
    
        /// <summary>
        /// A collection of the User's awarded badges.
        /// </summary>
        [JsonProperty("badges")]
        public List<Badge> Badges { get; set; }
    }
    
    public class Account
    {
        public string github;
    }
    
    public class Badge
    {
        [JsonProperty("name")]
        public string Name;
        [JsonProperty("description")]
        public string Description;
        [JsonProperty("created")]
        public string Created;
        [JsonProperty("badge")]
        public string BadgeUrl;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's simple view model that I use: public class ViewModel { public Order Order
I have simple User entity: public class User { public virtual int Id {
I have a simple application here (QandATable2.php) where when the user clicks on the
Here by simple, I mean a class with non-virtual empty destructor or POD type.
Here is my simple piece of code, where I build a String array and
Here is very simple question for experienced Git user. I've created repository on git
I have a Nhibernate mapping file for a simple user/role mapping. Here are the
I have a really simple user control called SetSpeed: <UserControl x:Class=AGWPFControls.SetSpeed xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml MinHeight=50
Hi i've got here a simple program, but it's not working properly. When i
Please excuse me if I'm simple here, I want to create a simple widget

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.