Difference between revisions of "JSON"
(Created page with "<blockquote>wp:JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and g...") |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <blockquote>[[wp:JSON|JSON]] (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language. | + | <blockquote>[[wp:JSON|JSON]] (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language. - http://json.org/</blockquote> |
− | JSON is pretty ubiquitous these days in web programming. An example is the [[JIRA]] bug tracker from Atlassian software which exposes it's data via API calls in JSON format. When working with large JSON data sets, it's helpful to have a viewer like http://jsonviewer.stack.hu/ which easily parses and renders the object in a tree fashion. | + | JSON is pretty ubiquitous these days in web programming. Most API communication is done using JSON. An example is the [[JIRA]] bug tracker from Atlassian software which exposes it's data via API calls in JSON format. Another example is the MediaWiki API, which also uses JSON as the communication format for it's API. |
+ | |||
+ | == Notes about working with JSON == | ||
+ | |||
+ | There's this [https://github.com/composer/composer/blob/master/src/Composer/Json/JsonFile.php code for reading/writing/validating JSON] which is used by the Composer project. | ||
+ | |||
+ | When working with large JSON data sets, it's helpful to have a viewer like http://jsonviewer.stack.hu/ which easily parses and renders the object in a tree fashion. [https://github.com/GerHobbelt/nicejson-php/blob/master/nicejson.php PHP code for formatting JSON] to make it "readable" aka "pretty print" is now built-in, as of PHP 5.4, with <code>json_decode JSON_PRETTY_PRINT</code> | ||
+ | |||
+ | There are other tools too for working with json | ||
+ | # Python <code>python -m json.tool myFile.json</code> | ||
+ | # Node based https://github.com/ddopson/underscore-cli | ||
+ | # Binary C https://stedolan.github.io/jq/ (with online viewer) | ||
[[Category:JavaScript]] | [[Category:JavaScript]] | ||
+ | [[Category:Data]] |
Latest revision as of 17:02, 2 August 2016
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language. - http://json.org/
JSON is pretty ubiquitous these days in web programming. Most API communication is done using JSON. An example is the JIRA bug tracker from Atlassian software which exposes it's data via API calls in JSON format. Another example is the MediaWiki API, which also uses JSON as the communication format for it's API.
Notes about working with JSON[edit | edit source]
There's this code for reading/writing/validating JSON which is used by the Composer project.
When working with large JSON data sets, it's helpful to have a viewer like http://jsonviewer.stack.hu/ which easily parses and renders the object in a tree fashion. PHP code for formatting JSON to make it "readable" aka "pretty print" is now built-in, as of PHP 5.4, with json_decode JSON_PRETTY_PRINT
There are other tools too for working with json
- Python
python -m json.tool myFile.json
- Node based https://github.com/ddopson/underscore-cli
- Binary C https://stedolan.github.io/jq/ (with online viewer)