using Newtonsoft.Json.Linq;
private static void JsonTest()
JArray array = new JArray
JObject jobject = new JObject();
jobject["SomeProperty"] = array;
jobject.AccumulateFunction("SomeProperty2", "someItem");
jobject.AccumulateFunction("SomeProperty", "someItem2");
Console.WriteLine(jobject);
private static void AccumulateFunction(this JObject jobject, string propertyName, object item)
if (jobject[propertyName] is JArray existingArray)
jobject[propertyName] = existingArray;
JArray newArray = new JArray { item };
jobject[propertyName] = newArray;
public static void Main()