From 960ee4a1856db8eadb96277bb2422edfa8f2a81c Mon Sep 17 00:00:00 2001 From: Gabriel Halley Date: Wed, 7 Oct 2015 23:11:24 -0400 Subject: removing whitespace all over --- json.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index 47a8cb21..6aff2ce2 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -16,7 +16,7 @@ going to be 100% valid JSON. Luckily, it kind of speaks for itself. ```json { "key": "value", - + "keys": "must always be enclosed in double quotes", "numbers": 0, "strings": "Hellø, wørld. All unicode is allowed, along with \"escaping\".", @@ -46,7 +46,7 @@ going to be 100% valid JSON. Luckily, it kind of speaks for itself. [0, 0, 0, 1] ] ], - + "alternative style": { "comment": "check this out!" , "comma position": "doesn't matter - as long as it's before the value, then it's valid" -- cgit v1.2.3 From 617599a527a7ee9e3d01a21f11338a1cba3e1eb5 Mon Sep 17 00:00:00 2001 From: himanshu81494 Date: Thu, 8 Oct 2015 15:49:51 +0530 Subject: Update json.html.markdown --- json.html.markdown | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index 6aff2ce2..f4adfc8b 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -4,6 +4,7 @@ filename: learnjson.json contributors: - ["Anna Harren", "https://github.com/iirelu"] - ["Marco Scannadinari", "https://github.com/marcoms"] + - ["himanshu", "https://github.com/himanshu81494"] --- As JSON is an extremely simple data-interchange format, this is most likely going @@ -13,6 +14,11 @@ JSON in its purest form has no actual comments, but most parsers will accept C-style (`//`, `/* */`) comments. For the purposes of this, however, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. +Data types supported by JSON includes: numbers, string, boolean, array, object and null. +Supporting browsers are: Firefox(Mozilla) 3.5, Internet Explorer 8, Chrome, Opera 10, Safari 4. +JSON file type for JSON files is ".json". The MIME type for JSON text is "application/json" +Drawbacks of JSON include lack of type definition and some sort of DTD. + ```json { "key": "value", -- cgit v1.2.3 From 7fd149485e0cbef6fc57206cb1377f261ed70278 Mon Sep 17 00:00:00 2001 From: Martin N Date: Fri, 9 Oct 2015 07:39:22 +0000 Subject: Mention of trailing commas in JSON and that they should be avoided --- json.html.markdown | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index 6aff2ce2..a85cecc4 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -10,8 +10,11 @@ As JSON is an extremely simple data-interchange format, this is most likely goin to be the simplest Learn X in Y Minutes ever. JSON in its purest form has no actual comments, but most parsers will accept -C-style (`//`, `/* */`) comments. For the purposes of this, however, everything is -going to be 100% valid JSON. Luckily, it kind of speaks for itself. +C-style (`//`, `/* */`) comments. Some parsers also tolerate a trailing comma +(i.e. a comma after the last element of an array or the after the last property of an object), +but they should be avoided for better compatibility. + +For the purposes of this, however, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. ```json { -- cgit v1.2.3 From 4c27047a9748c0d3197dc63de34cc8bebf03633f Mon Sep 17 00:00:00 2001 From: Vojta Svoboda Date: Fri, 9 Oct 2015 11:27:19 +0200 Subject: [json/en] Typo --- json.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index a85cecc4..a1629137 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -14,7 +14,7 @@ C-style (`//`, `/* */`) comments. Some parsers also tolerate a trailing comma (i.e. a comma after the last element of an array or the after the last property of an object), but they should be avoided for better compatibility. -For the purposes of this, however, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. +For the purposes of this, however, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. ```json { -- cgit v1.2.3 From 0e330607dfa9e47db7aa4271973ed74631d926a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wo=C5=BAniczak?= Date: Tue, 13 Oct 2015 22:02:06 +0200 Subject: Fixed incorrect information about commas in JSON doc --- json.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index b5e36090..060e9c3d 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -58,7 +58,7 @@ Drawbacks of JSON include lack of type definition and some sort of DTD. "alternative style": { "comment": "check this out!" - , "comma position": "doesn't matter - as long as it's before the value, then it's valid" + , "comma position": "doesn't matter - as long as it's before the next key, then it's valid" , "another comment": "how nice" }, -- cgit v1.2.3 From b4a125877fc0876890be4ac8e3877a5eaa57850f Mon Sep 17 00:00:00 2001 From: Michael Neth Date: Thu, 15 Oct 2015 15:21:52 -0500 Subject: Clarified some of the intro text Clarified the terminology of a "JSON value" and its limited set of options. Clarified that Supporting Browsers are from the shown version and up. Clarified that ".json" is the standard "file extension". --- json.html.markdown | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index 060e9c3d..260221bf 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -17,9 +17,11 @@ but they should be avoided for better compatibility. For the purposes of this, however, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. -Data types supported by JSON includes: numbers, string, boolean, array, object and null. -Supporting browsers are: Firefox(Mozilla) 3.5, Internet Explorer 8, Chrome, Opera 10, Safari 4. -JSON file type for JSON files is ".json". The MIME type for JSON text is "application/json" +A JSON value must be a number, a string, an array, an object, or one of the following 3 literal names: true, false, null. + +Supporting browsers are: Firefox 3.5+, Internet Explorer 8+, Chrome, Opera 10+, and Safari 4+. +File extension for JSON files is ".json" and the MIME type for JSON text is "application/json". + Drawbacks of JSON include lack of type definition and some sort of DTD. ```json -- cgit v1.2.3 From 56d0c93fd94f7ab9a6d2ee238dd6ef62d5f2a13e Mon Sep 17 00:00:00 2001 From: Michael Neth Date: Thu, 15 Oct 2015 15:25:26 -0500 Subject: Remove "drawbacks" sentence Opinionated information probably shouldn't end up in one of these, especially when it is non-comprehensive and does not include any of the "pro" arguments. --- json.html.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index 260221bf..ec802b33 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -20,9 +20,8 @@ For the purposes of this, however, everything is going to be 100% valid JSON. Lu A JSON value must be a number, a string, an array, an object, or one of the following 3 literal names: true, false, null. Supporting browsers are: Firefox 3.5+, Internet Explorer 8+, Chrome, Opera 10+, and Safari 4+. -File extension for JSON files is ".json" and the MIME type for JSON text is "application/json". -Drawbacks of JSON include lack of type definition and some sort of DTD. +File extension for JSON files is ".json" and the MIME type for JSON text is "application/json". ```json { -- cgit v1.2.3 From e951f409a0642e713e53b202545e928ffb15b676 Mon Sep 17 00:00:00 2001 From: Michael Neth Date: Thu, 15 Oct 2015 15:30:21 -0500 Subject: Added some more information about valid JSON A single array can also be valid JSON. Removed the "And, you're done. You now know everything JSON has to offer." value since I added additional information after it. --- json.html.markdown | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index ec802b33..5354b997 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -7,22 +7,22 @@ contributors: - ["himanshu", "https://github.com/himanshu81494"] --- -As JSON is an extremely simple data-interchange format, this is most likely going -to be the simplest Learn X in Y Minutes ever. +As JSON is an extremely simple data-interchange format, this is most likely going to be the simplest Learn X in Y Minutes ever. -JSON in its purest form has no actual comments, but most parsers will accept -C-style (`//`, `/* */`) comments. Some parsers also tolerate a trailing comma -(i.e. a comma after the last element of an array or the after the last property of an object), -but they should be avoided for better compatibility. +JSON in its purest form has no actual comments, but most parsers will accept C-style (`//`, `/* */`) comments. Some parsers also tolerate a trailing comma (i.e. a comma after the last element of an array or the after the last property of an object), but they should be avoided for better compatibility. For the purposes of this, however, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. A JSON value must be a number, a string, an array, an object, or one of the following 3 literal names: true, false, null. -Supporting browsers are: Firefox 3.5+, Internet Explorer 8+, Chrome, Opera 10+, and Safari 4+. +Supporting browsers are: Firefox 3.5+, Internet Explorer 8.0+, Chrome 1.0+, Opera 10.0+, and Safari 4.0+. File extension for JSON files is ".json" and the MIME type for JSON text is "application/json". +JSON is built on two structures: +* A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. +* An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. + ```json { "key": "value", @@ -61,8 +61,18 @@ File extension for JSON files is ".json" and the MIME type for JSON text is "app "comment": "check this out!" , "comma position": "doesn't matter - as long as it's before the next key, then it's valid" , "another comment": "how nice" - }, - - "that was short": "And, you're done. You now know everything JSON has to offer." + } } ``` + +A single array of values by itself is also valid JSON. + +```json +[1, 2, 3, "text", true] +``` + +Objects can be a part of the array as well. + +```json +[{"name": "Bob", "age": 25}, {"name": "Jane", "age": 29}, {"name": "Jack", "age": 31}] +``` -- cgit v1.2.3 From af1465d02f8c44fe5a803c058a6ea55219dfe997 Mon Sep 17 00:00:00 2001 From: Michael Neth Date: Thu, 15 Oct 2015 15:30:59 -0500 Subject: Added my contributor information --- json.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index 5354b997..140aa366 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -5,6 +5,7 @@ contributors: - ["Anna Harren", "https://github.com/iirelu"] - ["Marco Scannadinari", "https://github.com/marcoms"] - ["himanshu", "https://github.com/himanshu81494"] + - ["Michael Neth", "https://github.com/infernocloud"] --- As JSON is an extremely simple data-interchange format, this is most likely going to be the simplest Learn X in Y Minutes ever. -- cgit v1.2.3 From 76b8a3a36eb0b339c39d545ff186294ba7eb7ecc Mon Sep 17 00:00:00 2001 From: Michael Neth Date: Thu, 15 Oct 2015 15:35:13 -0500 Subject: Added a more info link and extra explanation Added link to json.org Included information about using JSON text as data. --- json.html.markdown | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index 140aa366..cde7bc40 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -20,10 +20,16 @@ Supporting browsers are: Firefox 3.5+, Internet Explorer 8.0+, Chrome 1.0+, Oper File extension for JSON files is ".json" and the MIME type for JSON text is "application/json". +Many programming languages have support for serializing (encoding) and unserializing (decoding) JSON data into native data structures. Javascript has implicit support for manipulating JSON text as data. + +More information can be found at http://www.json.org/ + JSON is built on two structures: * A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. * An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. +An object with various name/value pairs. + ```json { "key": "value", -- cgit v1.2.3 From 76e72653b28590f6aaea9e08ae38f9a812cc65e2 Mon Sep 17 00:00:00 2001 From: duci9y Date: Tue, 20 Oct 2015 14:24:32 +0530 Subject: [json/en] Cut noise, formatting, links. Also removed some duplicate information. --- json.html.markdown | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'json.html.markdown') diff --git a/json.html.markdown b/json.html.markdown index cde7bc40..a612cffe 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -8,27 +8,24 @@ contributors: - ["Michael Neth", "https://github.com/infernocloud"] --- -As JSON is an extremely simple data-interchange format, this is most likely going to be the simplest Learn X in Y Minutes ever. +JSON is an extremely simple data-interchange format. As [json.org](http://json.org) says, it is easy for humans to read and write and for machines to parse and generate. -JSON in its purest form has no actual comments, but most parsers will accept C-style (`//`, `/* */`) comments. Some parsers also tolerate a trailing comma (i.e. a comma after the last element of an array or the after the last property of an object), but they should be avoided for better compatibility. - -For the purposes of this, however, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. - -A JSON value must be a number, a string, an array, an object, or one of the following 3 literal names: true, false, null. - -Supporting browsers are: Firefox 3.5+, Internet Explorer 8.0+, Chrome 1.0+, Opera 10.0+, and Safari 4.0+. - -File extension for JSON files is ".json" and the MIME type for JSON text is "application/json". +A piece of JSON must represent either: +* A collection of name/value pairs (`{ }`). In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. +* An ordered list of values (`[ ]`). In various languages, this is realized as an array, vector, list, or sequence. + an array/list/sequence (`[ ]`) or a dictionary/object/associated array (`{ }`). -Many programming languages have support for serializing (encoding) and unserializing (decoding) JSON data into native data structures. Javascript has implicit support for manipulating JSON text as data. +JSON in its purest form has no actual comments, but most parsers will accept C-style (`//`, `/* */`) comments. Some parsers also tolerate a trailing comma (i.e. a comma after the last element of an array or the after the last property of an object), but they should be avoided for better compatibility. -More information can be found at http://www.json.org/ +For the purposes of this tutorial, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. -JSON is built on two structures: -* A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. -* An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. +Supported data types: -An object with various name/value pairs. +* Strings: `"hello"`, `"\"A quote.\""`, `"\u0abe"`, `"Newline.\n"` +* Numbers: `23`, `0.11`, `12e10`, `3.141e-10`, `1.23e+4` +* Objects: `{ "key": "value" }` +* Arrays: `["Values"]` +* Miscellaneous: `true`, `false`, `null` ```json { @@ -66,20 +63,20 @@ An object with various name/value pairs. "alternative style": { "comment": "check this out!" - , "comma position": "doesn't matter - as long as it's before the next key, then it's valid" + , "comma position": "doesn't matter, if it's before the next key, it's valid" , "another comment": "how nice" - } -} -``` + }, -A single array of values by itself is also valid JSON. -```json -[1, 2, 3, "text", true] -``` -Objects can be a part of the array as well. + "whitespace": "Does not matter.", -```json -[{"name": "Bob", "age": 25}, {"name": "Jane", "age": 29}, {"name": "Jack", "age": 31}] + + + "that was short": "And done. You now know everything JSON has to offer." +} ``` + +## Further Reading + +* [JSON.org](http://json.org) All of JSON beautifully explained using flowchart-like graphics. -- cgit v1.2.3