summaryrefslogtreecommitdiffhomepage
path: root/toml.html.markdown
diff options
context:
space:
mode:
authorDivay Prakash <divayprakash@users.noreply.github.com>2020-02-02 15:13:28 +0530
committerGitHub <noreply@github.com>2020-02-02 15:13:28 +0530
commit8eb11a89a7fc84dde15544c6f7ec99a8f44b0c9f (patch)
tree7605022884b652f7acf879328887a9d191d3ef58 /toml.html.markdown
parentab5a1953e77288ca27bd7b4c931d8bb2e79a9966 (diff)
parentf80889ed47ae42ca4ea2b8118e2b3c48c37eeb9c (diff)
Merge branch 'master' into master
Diffstat (limited to 'toml.html.markdown')
-rwxr-xr-xtoml.html.markdown33
1 files changed, 28 insertions, 5 deletions
diff --git a/toml.html.markdown b/toml.html.markdown
index 385a2437..2b234965 100755
--- a/toml.html.markdown
+++ b/toml.html.markdown
@@ -12,7 +12,7 @@ It is an alternative to YAML and JSON. It aims to be more human friendly than JS
Be warned, TOML's spec is still changing a lot. Until it's marked as 1.0, you
should assume that it is unstable and act accordingly. This document follows TOML v0.4.0.
-```
+```toml
# Comments in TOML look like this.
################
@@ -117,7 +117,7 @@ date4 = 1979-05-27 # without offset or time
array1 = [ 1, 2, 3 ]
array2 = [ "Commas", "are", "delimiters" ]
-array3 = [ "Don't mixed", "different", "types" ]
+array3 = [ "Don't mix", "different", "types" ]
array4 = [ [ 1.2, 2.4 ], ["all", 'strings', """are the same""", '''type'''] ]
array5 = [
"Whitespace", "is", "ignored"
@@ -171,6 +171,9 @@ c = 1
[a]
d = 2
+# Will generate the following in JSON:
+# { "a": {"b": {"c": 1}, "d": 2 } }
+
# You cannot define any key or table more than once. Doing so is invalid.
# DO NOT DO THIS
@@ -220,7 +223,27 @@ emptyTableAreAllowed = true
name = "Nail"
sku = 284758393
color = "gray"
+```
+The equivalent in JSON would be:
+```json
+{
+ "products": [
+ {
+ "name": "array of table",
+ "sku": 7385594937,
+ "emptyTableAreAllowed": true
+ },
+ {},
+ {
+ "name": "Nail",
+ "sku": 284758393,
+ "color": "gray"
+ }
+ ]
+}
+```
+```toml
# You can create nested arrays of tables as well. Each double-bracketed
# sub-table will belong to the nearest table element above it.
@@ -245,11 +268,11 @@ color = "gray"
[[fruit.color]]
name = "yellow"
note = "I am an array item in banana fruit's table/map"
-```
-
-In JSON land, this code will be:
+```
+The equivalent in JSON would be:
```json
+
{
"fruit": [
{