Console application that prints formatted JSON from a json string. "JValue.Parse(jsonString).ToString(Formatting.Indented)" can be used in you web application as well.
using Newtonsoft.Json;using Newtonsoft.Json.Linq;using System;namespace ConsoleAppTryOut{class Program{static void Main(string[] args){string jsonString = "[{\"Question\":{\"QuestionId\":49,\"QuestionText\":\"Whats your name?\",\"Answer\":\"xyz\"}},{\"Question\":{\"QuestionId\":51,\"QuestionText\":\"Are you smart?\",\"Answer\":\"Yes\"}}]";Console.WriteLine(JValue.Parse(jsonString).ToString(Formatting.Indented));Console.Read();}}}
No comments:
Post a Comment