0

I have the following string:

{"data.childData1":"s1","data.childData2":"s2",...}

How do I convert it to:

{"data":{
     "childData1":"s1",
      "childData2":"s2"
   }
}
Samar Rizvi
  • 423
  • 5
  • 18

1 Answers1

0

You can use this lib to beautify json, or use Json.NET (example source):

public string GetPrettyPrintedJson(string json)
{
    dynamic parsedJson = JsonConvert.DeserializeObject(json);
    return JsonConvert.SerializeObject(parsedJson, Formatting.Indented);
}
Moti Azu
  • 5,392
  • 1
  • 23
  • 32