Json: Difference between revisions
From wikinotes
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
A subset of javascript used for encoding structured data. | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
Line 13: | Line 8: | ||
"b":["peach","mango"] // json requires that the last list-element does not have a comma | "b":["peach","mango"] // json requires that the last list-element does not have a comma | ||
}, | }, | ||
"MyNull" : null, | "MyNull" : null, | ||
"boolean_true" : true, | "boolean_true" : true, | ||
"boolean_false" : false | "boolean_false" : false | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 33: | Line 28: | ||
"boolean" = true, | "boolean" = true, | ||
"null" = null | "null" = null | ||
} | } | ||
// compound datatypes | // compound datatypes |
Revision as of 02:30, 24 June 2022
A subset of javascript used for encoding structured data.
{
"MyCategory":{
"a":["apple","orange","banana"],
"b":["peach","mango"] // json requires that the last list-element does not have a comma
},
"MyNull" : null,
"boolean_true" : true,
"boolean_false" : false
}
datatypes
JSON natively supports 6x datatypes:
// simple datatypes { "string" = "my string", "number" = 9999, "boolean" = true, "null" = null } // compound datatypes { "object" = { "a":1, "b":1 }, // a dictionary "array" = [ "a","b","c" ] }