将json_编码php转换为javascript,但不带双引号

将json_编码php转换为javascript,但不带双引号,javascript,php,Javascript,Php,以下是php json_encode调用的输出: //start //docStructure version 1.0.alpha compiled September 16th, 2014 at 9:18PM var docStructure={"updateTime":"2014-09-16 21:18:19","listeners":[{"name":"eFaxListener","active":"0","url":"?action=faxvcheckinboundfax"}],"sec

以下是php json_encode调用的输出:

//start
//docStructure version 1.0.alpha compiled September 16th, 2014 at 9:18PM
var docStructure={"updateTime":"2014-09-16 21:18:19","listeners":[{"name":"eFaxListener","active":"0","url":"?action=faxvcheckinboundfax"}],"sections":{"defaultLayout":{"header":[]}},"editors":{"sideeditor":{"state":"closed","width":"0","context":""}}}//end
请注意,所有键的周围都有双引号

为了便于阅读,我更希望键没有双引号。有什么区别吗?我更愿意将其确定为

alert(docStructure.editors.siteeditor.state);
vs

或者我仍然可以将这些键作为字符串互换使用吗

谢谢,这是我对javascript思想的理解。

要求键被双引号引用,一旦被javascript解析,它只是一个普通对象,因此您可以通过两种方式访问它们,假设您的键是有效的对象键,而不是以数字或特殊字符开头。

您正在寻找的

说明:


获取格式良好的JSON字符串并返回结果JavaScript对象。

您可以使用上述任一访问方法。使用键时,键周围的引号对您没有任何影响
alert(docStructure['editors']['siteeditor']['state'])