using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
public static void Test()
var model = JsonConvert.DeserializeObject<JObject>(data, new JsonSerializerSettings{ DateParseHandling = DateParseHandling.None });
Console.WriteLine("Input model: ");
Console.WriteLine(model);
var serializer = JsonSerializer.CreateDefault(new JsonSerializerSettings{ DateTimeZoneHandling = DateTimeZoneHandling.Utc });
foreach (var locations in model.SelectTokens("Result[*].locations").OfType<JArray>())
var query = from location in locations
let utcDate = location.SelectToken("locTypeAttributes.utcDate").ToObject<DateTime>(serializer)
locations.ReplaceAll(query.ToList());
Console.WriteLine("\nSorted model: ");
Console.WriteLine(model);
""country"": ""Papua New Guinea"",
""city"": ""Jacquinot Bay"",
""localDate"": ""2018-10-08T04:21:00-07:00"",
""utcDate"": ""2018-10-08T04:21:00-07:00"",
""country"": ""Papua New Guinea2"",
""city"": ""Jacquinot Bay2"",
""localDate"": ""2018-10-08T04:21:00-07:00"",
""utcDate"": ""2018-10-02T04:21:00-07:00"",
public static void Main()
Console.WriteLine("Environment version: " + Environment.Version);
Console.WriteLine("Json.NET version: " + typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");
Do you want to sort the `"Result": []` array, or do you want to sort each `"Result[*].locations"` array? Because the locations themselves are an array so there might in principle be more than one, each with its own `utcDate`. And if you do want to sort the `"Results"` array how do you want to deal with the situation where a result has multiple locations with multiple `utcDate` values? [C# Sort JSON string keys](https: