Name array elements in Json.NET?
问题 Using Json.NET 10.0.3. Consider the following sample: class Foo { [JsonProperty("ids")] public int[] MyIds { get; set; } } Obviously, the elements of the array are unnamed. Now consider the following json : { "ids": [{ "id": 1 }, { "id": 2 } ] } And then we try to parse it: var json = @"{""ids"":[{""id"":1},{""id"":2}]}"; var result = JsonConvert.DeserializeObject<Foo>(son); Parsing the above fails with the following message: Newtonsoft.Json.JsonReaderException: Unexpected character