Jump to content
xisto Community
magiccode9

What Is Json? ,how It Works?

Recommended Posts

hi, I have found a term called JSON, it's Javascript Object Notation. After go through few web pages still dont get what it is? This is what it described :

JSON , which stands for "JavaScript Object Notation", is a lightweight computer data interchange format. JSON is a subset of the object literal notation of JavaScript but its use does not require Javascript.
JSON's simplicity has resulted in its widespread use, especially as an alternative to XML in Ajax. One of the claimed advantages of JSON over XML as a data interchange format in this context is that it is much easier to write a JSON parser. In JavaScript itself, JSON can be parsed trivially using the eval() procedure. This was important for the acceptance of JSON within the Ajax programming community because of JavaScript's ubiquity among web browsers.


Anyone who know what it is ? Could give me few examples ?
Only know how it contructs, but dont how to call and use it !!!


Thanks you !!!

Share this post


Link to post
Share on other sites

well from reading that little passage, by the looks of it, its another way to use javascript on your site and not have to worry about people having it turned off since doesn't require javascrpt tags to actually run it.Also by looking at some other sites it make programing in javascript quicker and more effective. havn't found any real scripts on the met myself. Ubt if I were to conclude that json is a server side coding for large amounts of info. But i think its a water down version of ajx and xml as well.

Share this post


Link to post
Share on other sites

I've use JSON for my PHP application.

JSON make easy to interchange between programming language to JavaScript,
Based what i've done, JSON is class/library that we can use to (ex:) convert
a variable from PHP variable to JavaScript Variable.

As Example : we have an array and we want to use the array in JavaScript

<?php$myArray = Array('a'=>'the first', 'b'=>'is second');$json = new JSON();echo $json->convert($myArray);?>

returned/print :

{a:'the first', b:'is second'}
:):(:(

I hope it could help you. :D

Share this post


Link to post
Share on other sites

Ever try and read through some javascript framework source code and see blocks and blocks of code nested in each other then get confused at why its like that? Thats JSON. I was trying to read documentation on a javascript framework last night and came across JSON again. This time I actually got a link to a useful article that explains what it is and how its used.

when your script contains 100's of functions it will be too confusing to look at each function and determine what it does and where its related to. With JSON you can group functions into an object this also helps with naming conflicts since it will have its own scope. Also if your working in teams this helps also with the naming conflicts.

If you use alot of javascript and your not using JSON your serisouly limiting yourself IMO, Learning to write javascript in JSON is very simple and once you get used to the structure you will be enjoying writing cleaner javascript code. It will also help you reading code used in javascript frameworks.

a must read introduction to JSON
http://www.dustindiaz.com/json-for-the-masses/

more reference and structure diagrams for JSON
http://www.json.org/

Share this post


Link to post
Share on other sites

I think it just parses objects from different web languages into a string, and when you include the JSON libraries for whatever language you're using, you can take that string and make it an object of whatever type you need.I came across it a while ago, but I never ended up using it, because I never get that far into making anything. I'll probably look into it farther now, though, because you reminded me of it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.