Jul 25, 2008

What Is Json? ,how It Works?

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

free web hosting

What Is Json? ,how It Works?

magiccode9
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 :

QUOTE
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 !!!

 

 

 


Reply

Saint_Michael
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.

Reply

hyuken
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

CODE

<?php
$myArray = Array('a'=>'the first', 'b'=>'is second');

$json = new JSON();

echo $json->convert($myArray);
?>


returned/print :

CODE
{a:'the first', b:'is second'}
blink.gif biggrin.gif biggrin.gif

I hope it could help you. biggrin.gif

 

 

 


Reply

sonesay
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/


Reply

hippiman
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.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. firefox json - 5.06 hr back. (1)
  2. json in firefox - 10.18 hr back. (1)
  3. firefox json - 11.46 hr back. (1)
  4. json firefox - 1.50 hr back. (2)
  5. what is .json - 38.08 hr back. (1)
  6. how to work with json - 62.31 hr back. (2)
  7. how json works - 62.73 hr back. (1)
  8. what is a json - 71.93 hr back. (2)
  9. json how it works - 108.67 hr back. (1)
  10. what is json - 1.78 hr back. (40)
  11. what is json? - 44.67 hr back. (4)
Similar Topics

Keywords : json, works

  1. Javascript Error
    Error "missing ) in parenthetical" with JSON statment (2)
  2. Simple Firefox Vs. Ie Script Bug; Need A Little Help
    Simple script works in Firefox but not IE. (3)
    Hello I have a simple .js file that seems to work in Firefox but not IE. The error could totally be
    my syntax, just not sure why it's working in one browser and not the other. All I'm doing
    is waiting for an image to load completely before redirecting. I added an extra step that waits an
    additional 1.5 seconds just for 100% smooth transition (sometimes firefox reroutes before the image
    is actually fully loaded). This script works perfectly for Firefox, meaning if the image is already
    loaded/cached it reroutes immediately and if not, then waits with extra dela....
  3. Opera Browser + Javascript + Embeded Sound
    Embeded sound works in IE, but not in Opera (0)
    Hello! Here is the problem. There is an Embed object, created like this: function
    createWMPEmbedMarkup(src, id, baseurl) { // For choice, using the DOM instead of a string
    // so the caller gets a node. (Its childNode could be used if you don't want the whole p
    element) // Then, if markup is needed instead, innerHTML is available. var x =
    document.createElement("embed"); x.setAttribute("FileName", src);
    x.setAttribute("type", "application/x-mplayer2"); x.setAttribute("AutoStart", "0");
    x.setAttribute("id....
  4. One Click To Copy Script
    In IE6 it works, but not FF2 (4)
    Could everyone have a look at this and suggest how to get this working in FF and/or maybe Opera???
    If you look at this link using IE6 (possibly IE7), you should be able to click on the buttons to
    copy the textarea to the clipboard and then paste it into the blank textarea. Works great in IE, but
    not Firefox or Opera or Netscape Browsers. Link Demo: Here Bring your IE Browser. As per the
    above, it won't work in FF. Javascript for one-click highlight and copy to clipboard
    <script type="text/javascript"> function doact(d) { var doc = eval....
  5. [help] Java Script: Window.open
    Works with Firefox, not IE (8)
    CODE <HEAD> var popUpWin=0; function popUpWindow(URLStr) {
     if(popUpWin)  {    if(!popUpWin.closed) popUpWin.close();  }
     popUpWin = open(URLStr, 'GunBound Tactics: Screenshots',
    'width=820,height=550,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=90,left=90')
    ;; } </HEAD> <BODY> <a
    href="javascript:popUpWindow('/f11/clipped.php');"><b>Clips&
    #60;/b></a> This is a script for opening a new window. It works ....

    1. Looking for json, works

Searching Video's for json, works
advertisement



What Is Json? ,how It Works?



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE