Ganesan Mani
Ganesan Mani

Reputation: 65

creating C# code to get the value from json file

I have developed one online bus seat booking project, here I am using the API for each operation.

One operation had to write the information in .xml file now which they have changed to .json. Already I have got the value from .xml, but I didn't know how to get the value from .json.

Upvotes: 0

Views: 252

Answers (1)

Hiren Desai
Hiren Desai

Reputation: 1101

It depends upon type of method you are using. As far as they are GET you can get value from Request.QueryString["Key"] and if the method type is of POST then you can get those from Request.Form["key"].
To return the result in Json format you can either use .Net 3.0 System.Web.script.Serialization namespace which contains Class for converting object to json data JavaScriptSerializer or you can use some third party dll such as JSON.NET One that fall in my favorite list while dealing with jSon data.

Upvotes: 1

Related Questions