using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
public static void Test()
var jsonString = GetJson();
var array = JArray.Parse(jsonString);
var query = array.Select(i =>
new JObject(i.SelectTokens("Fields[*]").Select(o => new JProperty((string)o["Key"], o["Value"]))));
var newArray = new JArray(query);
Console.WriteLine(newArray);
Assert.That(JToken.DeepEquals(JArray.Parse(GetRequiredJson()), newArray));
Func<JToken, JObject> f = i => new JObject(i.SelectTokens("Fields[*]").Select(o =>
new JProperty((string)o["Key"], o["Value"])));
static string GetJson() =>
static string GetRequiredJson() =>
public static void Main()
Console.WriteLine("Environment version: {0} ({1}), {2}", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription , Environment.Version, Environment.OSVersion);
Console.WriteLine("{0} version: {1}", typeof(JsonSerializer).Namespace, typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");