I am using JavaScriptSerializer for serializing objects to the file to the JSON format. But the result file has no readable formatting. How can I allow formating to get a readable file?
You could use JSON.NET serializer, it supports JSON formatting
string body = JsonConvert.SerializeObject(message, Formatting.Indented);
Yon can download this package via NuGet.