Title: C# DeserializeObject
Last modified: December 30, 2020

---

# C# DeserializeObject

 *  Resolved [cm3solutions](https://wordpress.org/support/users/cm3solutions/)
 * (@cm3solutions)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/c-deserializeobject/)
 * I am trying to take the json on DeserializeObject it so I can use the player 
   data in my application. My code looks like this.
 *     ```
       List<Root> list;
   
                   string json = new WebClient().DownloadString(URL_Player);
   
                   list = JsonConvert.DeserializeObject<List<Root>>(json);
       ```
   
 * Root is a class I created and it works fine if I return a single player like 
   this
 * `list = JsonConvert.DeserializeObject<Root>(json);`
 * Its just when I try to return a full list of players I get
 * “Newtonsoft.Json.JsonSerializationException: ‘Cannot deserialize the current 
   JSON object (e.g. {“name”:”value”}) into type ‘System.Collections.Generic.List`
   1[System.Object]’ 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<T>) 
   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.”
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fc-deserializeobject%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Roch](https://wordpress.org/support/users/rochesterj/)
 * (@rochesterj)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/c-deserializeobject/#post-13854213)
 * Hi there!
 * Thanks for reaching out.
 * I’m not sure if we can help you with this one though as it is related to custom
   coding.
 * [@savvasha](https://wordpress.org/support/users/savvasha/), do you have any ideas
   about this one?
 * Thanks!
 *  Plugin Contributor [Savvas](https://wordpress.org/support/users/savvasha/)
 * (@savvasha)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/c-deserializeobject/#post-13854275)
 * Hmm, SportsPress uses the native wordpress framework for REST API. I am not sure
   that is wise to alterate the output format instead of adapt the way the client
   process the site’s json response.
 * Thanks,
    Savvas

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘C# DeserializeObject’ is closed to new replies.

 * ![](https://ps.w.org/sportspress/assets/icon-256x256.png?rev=1252005)
 * [SportsPress - Sports Club & League Manager](https://wordpress.org/plugins/sportspress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/sportspress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/sportspress/)
 * [Active Topics](https://wordpress.org/support/plugin/sportspress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sportspress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sportspress/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [json](https://wordpress.org/support/topic-tag/json/)

 * 2 replies
 * 3 participants
 * Last reply from: [Savvas](https://wordpress.org/support/users/savvasha/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/c-deserializeobject/#post-13854275)
 * Status: resolved