i have created following format JSON array in PHP. But now i want to create same format JSON array in ASP.net using C# code . How can i create it?
{
"android": [
{
"name": "aaa",
"version": "123"
},
{
"name": "bb",
"version": "34"
},
{
"name": "cc",
"version": "56"
}
]
}
am using following method
Public Class OutputJson
{
public List<Entity> Android { get; set; }
}
Public Class Entity
{
Public string Name { get; set; }
Public string Version { get; set; }
}
outputJson = new OutputJson{
Android = new List<Entity>
{
new Entity { Name = "aaa", Version = "123"},
new Entity { Name = "bb", Version = "34"},
new Entity { Name = "cc", Version = "56"},
}
var output = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(outputJson);
string YourJsonArray = output;
Response.Clear();
Response.ContentType = "application/json; charset=utf-8";
Response.Write(YourJsonArray );
Response.End();
am receive following error
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
How can i solve it?