So, I know the definition of json, I know its a lightweight data format.
As I am not an expert on this subject I would like to know, when can I use JSON, in which scenarios or applications? How to do it in c#?
I suppose I would Use Json only in applications where I intend to use ajax?
I use Json to call web service methods only so that I can use javascript to show the results without a postback?
Is JSON something to be used only in web forms applications? asp.net mvc applications? silverlight? winforms?
Well, you ask too many questions. My personal view on JSON:
1) JSON is a good tool if you need to deal with AJAX (as Sietse pointed out it should be called AJAJ in this case) and webservices
2) JSON is a good tool if you generally need to communicate between different platforms. I used it for communication between PHP and C# program because JSON is implemented in so many languages it is natural to use it and avoid creating custom communication procotol.
JSON can be useful whenever you want to pass data between programs written in two different languages. It's often used in AJAX scenarios, like in your example - a Javascript client receiving data from a server written in C#. But it can be useful in any other situation where your data has to cross a language barrier.
Other alternatives to JSON are XML, SOAP, CSV, YAML, etc...
JSON is popular because it can transfer data reliably in a well-defined format (unlike CSV) and is also easily human readable (unlike SOAP).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With