Question:
Why do we have to use JSON?
durasoul
2012-11-05 19:01:48 UTC
Within the context of communicating asynchronously with a server that uses PHP, why do we have to use JSON if we are sending an object?
Three answers:
?
2012-11-05 19:11:54 UTC
You aren't forced to use JSON, but you if you do, you get a standardized way to do it that is easily understood. In addition, it converts directly back to an object. It's certainly possible to pass your own construct, and build the object you need from it, but you'd need to do that for each different object, and the next programmer may not have a clue what the data means by looking at it.
2016-12-28 19:38:44 UTC
The call of your question merits a diverse answer than the only interior the physique. JSON and XML are 2 diverse technologies, each with their particular makes use of. in case you have been to interchange areas of your XHTML with diverse fragments which you retrieve via AJAX, then you certainly might besides deliver it as XML, waiting to be inserted into the present physique (the ML in XHTML propose the comparable as in XML). in case you decide on insert different products of records, properly..: the J in JSON is the comparable because of the fact the J in AJAX, so which you will think of that it would be a stable journey.
2012-11-06 04:56:45 UTC
JSON and XML are commonly used for transferring data through network. There are library for you to parse these formats, saves you many lines of code.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...