JSON object
Translation results:
JSON objects are written in curly brackets ({}).
JSON objectsyntax
Objects can contain multiple key/value (key/value) pairs.
key must be a string, value can be a legal JSON data type (string, number, object, array, Boolean or null).
Use colon (:) to separate key and value.
Each key/value pair is separated by commas (,).
JSON objectexample
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php.cn</title> </head> <body> <p>你可以使用点号(.)来访问 JSON 对象的值:</p> <p id="demo"></p> <script> var myObj, x; myObj = { "name":"php.cn", "alexa":10000, "site":null }; x = myObj.name; document.getElementById("demo").innerHTML = x; </script> </body> </html>
Run instance »
Click the "Run instance" button to view the online instance