| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/JSON | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..
* Some parts of this feature may have varying levels of support.
JSON JavaScript (JavaScript Object Notation JSON) JSON. , .
JSON , , , null. JavaScript, : JavaScript JSON, JSON JavaScript. JSON: JavaScript, ( ).
| JavaScript | JSON |
|---|---|
| , ; . | |
| ; . | |
|
;
;
(U+2028) (U+2029); .
, js |
JSON:
JSON = null
or true or false
or JSONNumber
or JSONString
or JSONObject
or JSONArray
JSONNumber = - PositiveNumber
or PositiveNumber
PositiveNumber = DecimalNumber
or DecimalNumber . Digits
or DecimalNumber . Digits ExponentPart
or DecimalNumber ExponentPart
DecimalNumber = 0
or OneToNine Digits
ExponentPart = e Exponent
or E Exponent
Exponent = Digits
or + Digits
or - Digits
Digits = Digit
or Digits Digit
Digit = 0 through 9
OneToNine = 1 through 9
JSONString = ""
or " StringCharacters "
StringCharacters = StringCharacter
or StringCharacters StringCharacter
StringCharacter = any character
except " or \ or U+0000 through U+001F
or EscapeSequence
EscapeSequence = \" or \/ or \\ or \b or \f or \n or \r or \t
or \u HexDigit HexDigit HexDigit HexDigit
HexDigit = 0 through 9
or A through F
or a through f
JSONObject = { }
or { Members }
Members = JSONString : JSON
or Members , JSONString : JSON
JSONArray = [ ]
or [ ArrayElements ]
ArrayElements = JSON
or ArrayElements , JSON
, JSON ( ) JSON ( ). (U+0009), (U+000D), (U+000A) , , (U+0020).
JSON.parse()JSON, .
JSON.stringify()JSON, , .
JSON . , , JSON , (, Internet Explorer 6).
JSON:
if (!window.JSON) {
window.JSON = {
parse: function (sJSON) {
return eval("(" + sJSON + ")");
},
stringify: function (vContent) {
if (vContent instanceof Object) {
var sOutput = "";
if (vContent.constructor === Array) {
for (
var nId = 0;
nId < vContent.length;
sOutput += this.stringify(vContent[nId]) + ",", nId++
);
return "[" + sOutput.substr(0, sOutput.length - 1) + "]";
}
if (vContent.toString !== Object.prototype.toString) {
return '"' + vContent.toString().replace(/"/g, "\\$&") + '"';
}
for (var sProp in vContent) {
sOutput +=
'"' +
sProp.replace(/"/g, "\\$&") +
'":' +
this.stringify(vContent[sProp]) +
",";
}
return "{" + sOutput.substr(0, sOutput.length - 1) + "}";
}
return typeof vContent === "string"
? '"' + vContent.replace(/"/g, "\\$&") + '"'
: String(vContent);
},
};
}
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-json-object |
This page was last modified on 17 . 2024 . by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |