jp504
13 Mar 2011, 11:25 PM
I have been learning the syntax of JSON for a few days now. The syntax is not what is confusing me, but how it implemented on a web site. What is JSON used for? Is it supposed to replace the use of XML? Is it how people write OOP code in Javascript these days? Am I supposed to write OOP code in JS as JSON's syntax and not the many functions I'm so used to?
Too many questions. :confused:
Thanks in advance.
coiner
14 Mar 2011, 02:03 AM
JSON is just a way to represent a JavaScript object textually. If you've ever worked with object oriented programming, it can be compared to serializing an object. It is a good replacement for XML in certain applications, for example, a JavaScript client passing information to and from a server via AJAX. JSON is immediately usable by JavaScript as an object and so you skip having to parse XML when you're sending this information back and forth.
Most programming languages have support for decoding JSON either built in, or via a third party function. This makes it very simple to transfer objects between JavaScript and other languages with only one or two lines of code. I'm sure you see the power in that :)
Powered by vBulletin® Version 4.2.0 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.