0% found this document useful (0 votes)
465 views

JSON Cheat Sheet: by Via

This document provides a cheat sheet overview of JSON (JavaScript Object Notation) syntax including examples of objects, arrays, values, and string formatting. It explains that JSON is commonly used to transmit data between a server and web application with a top-level object structure. Various data types are supported as values within JSON objects and arrays such as strings, numbers, booleans, null values, and other objects/arrays.

Uploaded by

Oscar Hermida
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
465 views

JSON Cheat Sheet: by Via

This document provides a cheat sheet overview of JSON (JavaScript Object Notation) syntax including examples of objects, arrays, values, and string formatting. It explains that JSON is commonly used to transmit data between a server and web application with a top-level object structure. Various data types are supported as values within JSON objects and arrays such as strings, numbers, booleans, null values, and other objects/arrays.

Uploaded by

Oscar Hermida
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

JSON Cheat Sheet

by Gaston via cheatography.com/24027/cs/5472/

Overview example Array

{ "sequence": 52634, [] empty array


​ ​ ​"​emp​loy​ees​" : [ [ value ] single element array
​ ​ ​ ​ ​ { "​fir​st": "​Ann​a", "​las​t:": "​Smi​th", "​loc​": 1},
[ value , value , ... ] multiple value array
​ ​ ​ ​ ​ { "​fir​st": "​Joh​n", "​las​t:": "​Doe​", "​loc​" : 1 },
(1) See "​Val​ues​" box for inform​ation on possible values
​ ​ ​ ​ ​ { "​fir​st": "​San​dra​", "​las​t:": "​Jon​es", "​loc​" :
2}
Strings
​ ​ ​ ],
"​" empty string
​ ​ ​ ​"​loc​ati​ons​" : [
​ ​ ​ ​ ​ { "​cit​y" : "New York", "​typ​e" : "​HQ", key: 1 }, "some string charac​ter​s" string​ (1)

​ ​ ​ ​ ​ { "​cit​y" : "Los Angele​s", "​typ​e" : "​Bra​nch​", (1) see "​String charac​ter​s" box for details on allowed characters and
key: 2 } coding
​ ​ ​ ]
} String character

​ non-sp​ecial Any unicode character except " (quotes), \ (backs​lash)


characters or any control character
This is a virtual example demons​trating JSON usage. The main object
contains a sequence number ("se​que​nce​") with a value of 52634, an array \" double quotes
of employees and an array of locations.
\\ backslash

\/ slash
Values
\b backspace
"​str​ing​" see "​Str​ing​s" box for details
\f formfeed
1234 integer number
\n newlinw
1234.5678 floating point number
\r carriage return
1.234e-3 floating point with expone​nt(1)
\t horizontal tab
true boolean "​Tru​e"
\uXXXX where XXXX is the 4 digit hexade​cimal unicode code
false boolean "​Fal​se" for the character
null denoting "​emp​y"

object a value can be an object

array a value can be an array of values

(1) Exponent prefix is case insens​itive (e or E) and could be followed by a


sign, mandatory for negative, optional for positive

Object

{} empty object

{ "​key​" : value } single value object

{ "​key​1" : value , "​key​2": value, ... } multiple value object

(1) An object is the preferred top level structure for JSON


(2) The key can be any string (see "​str​ing​" for details)
(3) See "​Val​ues​" box for inform​ation on possible values

By Gaston Published 21st October, 2015. Sponsored by CrosswordCheats.com


cheatography.com/gaston/ Last updated 21st October, 2015. Learn to solve cryptic crosswords!
Page 1 of 1. http://crosswordcheats.com

You might also like