{"id":1239,"date":"2022-04-01T22:35:28","date_gmt":"2022-04-01T17:05:28","guid":{"rendered":"https:\/\/restfulapi.net\/?p=1239"},"modified":"2022-04-01T22:35:29","modified_gmt":"2022-04-01T17:05:29","slug":"valid-json-key-names","status":"publish","type":"post","link":"https:\/\/restfulapi.net\/valid-json-key-names\/","title":{"rendered":"Valid Key Names in JSON"},"content":{"rendered":"\n
In JSON, data is written in form of key-value pairs. The keys are written in double quotes<\/strong> and values are written according to their data types.<\/p>\n\n\n\n According to JSON.org<\/a>, a\u00a0string<\/em>\u00a0is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. Any valid string can be used as a JSON key<\/strong>. <\/p>\n\n\n\n These keys must be enclosed in the double-quotes ( The following characters are invalid when used in a JSON key:<\/p>\n\n\n\n <\/p>\n","protected":false},"excerpt":{"rendered":" In JSON, data is written in form of key-value pairs. The keys are written in double quotes and values are written according to their data types. JSON Keys must be Valid Strings According to JSON.org, a\u00a0string\u00a0is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. Any valid string can … Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":249,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/posts\/1239"}],"collection":[{"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/comments?post=1239"}],"version-history":[{"count":0,"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/posts\/1239\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/media\/249"}],"wp:attachment":[{"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/media?parent=1239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/categories?post=1239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/restfulapi.net\/wp-json\/wp\/v2\/tags?post=1239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}{\r\n\t\"id\" : 10,\r\n\t\"name\" : \"Lokesh\",\r\n\t\"role\" : [\"admin\", \"author\"]\r\n}<\/code><\/pre>\n\n\n\n
JSON Keys must be Valid Strings<\/h2>\n\n\n\n
\"<\/code>). This means if the key name contains any double quote in it, then it must be escaped.<\/p>\n\n\n\n
{\"Some \\\"random\\\" string\" : \"value\"}<\/code><\/pre>\n\n\n\n
\"<\/code>\u00a0(double quote) – It must be escaped.<\/li>
\\<\/code>\u00a0(backslash) – It must be used to escape certain characters.<\/li>
\\n<\/code>,\u00a0
\\t<\/code><\/li><\/ul>\n\n\n\n