Tags:
create new tag
, view all tags

JSON

JSON (pronounced like the English given name Jason), 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 in Ajax. In JavaScript, 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. (from Wikipedia:JSON)

Examples

Examples from http://www.json.org/example.html

----------------------------------------------------
{"menu": {
  "id": "file",
  "value": "File",
  "popup": {
    "menuitem": [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
}}
----------------------------------------------------
{"widget": {
    "debug": "on",
    "window": {
        "title": "Sample Konfabulator Widget",
        "name": "main_window",
        "width": 500,
        "height": 500
    },
    "image": { 
        "src": "Images/Sun.png",
        "name": "sun1",
        "hOffset": 250,
        "vOffset": 250,
        "alignment": "center"
    },
    "text": {
        "data": "Click Here",
        "size": 36,
        "style": "bold",
        "name": "text1",
        "hOffset": 250,
        "vOffset": 100,
        "alignment": "center",
        "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
    }
}}
----------------------------------------------------

-- Contributors: PeterThoeny - 2010-06-19

Discussion

JSON is one of the hot topics at AJAXWorld conference, Santa Clara, CA, Oct 2006.

-- PeterThoeny - 04 Oct 2006

I am looking for a way to way to write a JSON string from javascript to a topic. Any ideas?

-- ArthurClemens - 06 Nov 2006

That looks pretty easy: Have a look at the JSON stringifier at http://www.json.org/js.html, for download http://www.json.org/json.js. Simply use the toJSONString method to fill a text area, or in a document.write. Or did I miss something?

-- HaraldJoerg - 06 Nov 2006

But will the string be saved in the topic?

-- ArthurClemens - 06 Nov 2006

JSPopupPlugin and InlineEditPlugin use the CPAN JSON module to bring the JSON string into a perl object. Arthur, can you be more specific? saved as a string, or saved somehow differently?

-- SvenDowideit - 06 Nov 2006

I was thinking to TWikify this js outliner: http://www.decafbad.com/2005/07/map-test/tree2.html. Would be nice to save the ouliner every time the input field loses focus.

-- ArthurClemens - 06 Nov 2006

 
Topic revision: r7 - 2010-06-19 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by PerlIdeas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.