diff options
Diffstat (limited to 'toml.html.markdown')
-rwxr-xr-x | toml.html.markdown | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/toml.html.markdown b/toml.html.markdown index 980563f9..2b234965 100755 --- a/toml.html.markdown +++ b/toml.html.markdown @@ -32,7 +32,7 @@ boolean = true dateTime = 1979-05-27T07:32:00-08:00 scientificNotation = 1e+12 "key can be quoted" = true # Both " and ' are fine -"key may contains" = "letters, numbers, underscores, and dashes" +"key may contain" = "letters, numbers, underscores, and dashes" # A bare key must be non-empty, but an empty quoted key is allowed "" = "blank" # VALID but discouraged @@ -102,9 +102,10 @@ boolMustBeLowercase = true # Datetime # ############ -date1 = 1979-05-27T07:32:00Z # follows the RFC 3339 spec -date2 = 1979-05-27T07:32:00 # without offset -date3 = 1979-05-27 # without offset nor time +date1 = 1979-05-27T07:32:00Z # UTC time, following RFC 3339/ISO 8601 spec +date2 = 1979-05-26T15:32:00+08:00 # with RFC 3339/ISO 8601 offset +date3 = 1979-05-27T07:32:00 # without offset +date4 = 1979-05-27 # without offset or time #################### # COLLECTION TYPES # @@ -116,7 +117,7 @@ date3 = 1979-05-27 # without offset nor 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" @@ -170,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 @@ -219,36 +223,56 @@ 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. [[fruit]] - name = "apple" + name = "apple" # I am a property in fruit table/map - [fruit.Geometry] + [fruit.geometry] shape = "round" - note = "I am an fruit's property" + note = "I am a property in geometry table/map" [[fruit.color]] name = "red" - note = "I am an array's item in apple" + note = "I am an array item in apple fruit's table/map" [[fruit.color]] name = "green" - note = "I am in the same array than red" + note = "I am in the same array as red" [[fruit]] name = "banana" [[fruit.color]] name = "yellow" - note = "I am an array's item too but banana's one" -``` - -In JSON land, this code will be: + note = "I am an array item in banana fruit's table/map" +``` +The equivalent in JSON would be: ```json + { "fruit": [ { |