using System.Collections.Generic;
using Newtonsoft.Json.Linq;
public static void Main()
""property1"": ""value1"",
""arrayProperty1"": ""im the first object in array"",
""arrayProperty2"": ""some value""
""arrayProperty1"": ""im the second object in array"",
""arrayProperty2"": ""some value""
string json1 = AddPrefixToAllKeys(json, "mynamespace.");
Console.WriteLine(json1);
public static string AddPrefixToAllKeys(string json, string prefix)
JContainer token = (JContainer)JToken.Parse(json);
foreach (JProperty prop in token.Descendants().OfType<JProperty>().Reverse().ToList())
prop.Replace(new JProperty(prefix + prop.Name, prop.Value));