Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem Deserialising JSON to List<T>
    primarykey
    data
    text
    <p>I have a problem Deserialising a JSON string to a List</p> <p>the TCProject is as follows:</p> <pre><code>[JsonObject(MemberSerialization.OptIn)] public class TCProject { public override string ToString() { return Name; } [JsonProperty(PropertyName = "archived")] public bool Archived { get; set; } [JsonProperty(PropertyName = "description")] public string Description { get; set; } [JsonProperty(PropertyName = "href")] public string Href { get; set; } [JsonProperty(PropertyName = "id")] public string Id { get; set; } [JsonProperty(PropertyName = "name")] public string Name { get; set; } [JsonProperty(PropertyName = "webUrl")] public string WebUrl { get; set; } } </code></pre> <p>The JSON string looks as follows:</p> <pre><code>{"project":[{"name":"GCUK","id":"project11","href":"/httpAuth/app/rest/projects/id:project11"},{"name":"Interiors In Spain","id":"project3","href":"/httpAuth/app/rest/projects/id:project3"}]} </code></pre> <p>the code to convert the string is as follows:</p> <pre><code>public IEnumerable&lt;TCProject&gt; GetAllProjects() { var uri = _connection.CreateUri("/httpAuth/app/rest/projects"); var request = _connection.Request(uri); var projects = JsonConvert.DeserializeObject&lt;List&lt;TCProject&gt;&gt;(request); return projects; } </code></pre> <p>The exception I am getting:</p> <blockquote> <p>Newtonsoft.Json.JsonSerialisationException: {"Cannot deserialize JSON object into type 'System.Collections.Generic.List`1[TCProject]'."}</p> </blockquote> <p>there has got to be something really easy that i'm missing - anyone got any ideas?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload