Tuesday, June 12, 2012

JSON to C#

With the increased interested and usage of web(or REST) API’s, sooner or later you’ll have to consume an external JSON-producing service. As a C# developer  it's nice to have locally-defined static types that you can code against. But writing all these classes that match the JSON data is a boring and cumbersome task.

Let’s introduce json2csharp This tool will takeover this task and generates C# classes from JSON for you.


How to use it?

Type or paste a JSON string or a URL that produces JSON into the large text area, then click the Generate button.

Let’s take the results from this twitter search(http://search.twitter.com/search.json?q=c%23) and convert it to some C# objects

The JSON result(looks like a lot of work to convert this ourself)…
The generated C#objects(clean and simple)


No comments: