[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/JSON [Back]  [Original]

JSON - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

JSON

*

20157

*

JSON JavaScript JSON JSON

JSON new JSON JSON` Math

JavaScript JSON

JSON null JavaScript JavaScript JSON

NaN Infinity

JSON JavaScript JSON U+2028 U+2029 JSON JavaScript SyntaxError

undefined JSON Babel JSON5 YAML

JavaScript JSON JSON

JSON

JSON ABNF IETF JSON RFC

JSON-text = object / array
begin-array     = ws %x5B ws  ; [ 
begin-object    = ws %x7B ws  ; { 
end-array       = ws %x5D ws  ; ] 
end-object      = ws %x7D ws  ; } 
name-separator  = ws %x3A ws  ; : 
value-separator = ws %x2C ws  ; , 
ws = *(
     %x20 /              ; 
     %x09 /              ; 
     %x0A /              ; 
     %x0D                ; 
     )
value = false / null / true / object / array / number / string
false = %x66.61.6c.73.65   ; false
null  = %x6e.75.6c.6c      ; null
true  = %x74.72.75.65      ; true
object = begin-object [ member *( value-separator member ) ]
         end-object
member = string name-separator value
array = begin-array [ value *( value-separator value ) ] end-array
number = [ minus ] int [ frac ] [ exp ]
decimal-point = %x2E       ; .
digit1-9 = %x31-39         ; 1-9
e = %x65 / %x45            ; e E
exp = e [ minus / plus ] 1*DIGIT
frac = decimal-point 1*DIGIT
int = zero / ( digit1-9 *DIGIT )
minus = %x2D               ; -
plus = %x2B                ; +
zero = %x30                ; 0
string = quotation-mark *char quotation-mark
char = unescaped /
    escape (
        %x22 /          ; "         U+0022
        %x5C /          ; \       U+005C
        %x2F /          ; /       U+002F
        %x62 /          ; b       U+0008
        %x66 /          ; f       U+000C
        %x6E /          ; n       U+000A
        %x72 /          ; r       U+000D
        %x74 /          ; t       U+0009
        %x75 4HEXDIG )  ; uXXXX        U+XXXX
escape = %x5C              ; \
quotation-mark = %x22      ; "
unescaped = %x20-21 / %x23-5B / %x5D-10FFFF
HEXDIG = DIGIT / %x41-46 / %x61-66   ; 0-9, A-F, or a-f
       ; HEXDIG  [RFC5234]  HEXDIG 
DIGIT = %x30-39            ; 0-9
      ; DIGIT  [RFC5234]  DIGIT 

JSONNumber JSONStringU+0009U+000DU+000AU+0020

JSON[Symbol.toStringTag]

[Symbol.toStringTag] "JSON" Object.prototype.toString()

JSON.parse()

JSON

JSON.stringify()

JSON

JSON

json
{
  "browsers": {
    "firefox": {
      "name": "Firefox",
      "pref_url": "about:config",
      "releases": {
        "1": {
          "release_date": "2004-11-09",
          "status": "retired",
          "engine": "Gecko",
          "engine_version": "1.7"
        }
      }
    }
  }
}

JSON.parse() JSON JavaScript

js
const jsonText = `{
  "browsers": {
    "firefox": {
      "name": "Firefox",
      "pref_url": "about:config",
      "releases": {
        "1": {
          "release_date": "2004-11-09",
          "status": "retired",
          "engine": "Gecko",
          "engine_version": "1.7"
        }
      }
    }
  }
}`;

console.log(JSON.parse(jsonText));

ECMAScript 2027 LanguageSpecification
# sec-json-object


Web Proxy Viewer  |  New URL  |  Original Page