Javascript数据格式,这是JSON吗?

Hen*_*son 2 javascript jquery json

我使用的一些jquery插件需要这种格式的数据作为其输入类型

[
{image : '1.jpg', title : 'Title', url : '', age : 24, location : 'US', name : 'John', description : 'Long Text'},  
{image : '1.jpg', title : 'Title', url : '', age : 24, location : 'US', name : 'John', description : 'Long Text'}, 
{image : '1.jpg', title : 'Title', url : '', age : 24, location : 'US', name : 'John', description : 'Long Text'}
]
Run Code Online (Sandbox Code Playgroud)

我的问题是,这种数据是什么以及如何创建它?这还是JSON吗?因为当我尝试使用PHP传递json_encoded数组并使用jquery获取它时,我得到以下格式:

[
{'image' : '1.jpg', 'title' : 'Title', 'url' : '', 'age' : 24, 'location' : 'US', 'name' : 'John', 'description' : 'Long Text'},  
{'image' : '1.jpg', 'title' : 'Title', 'url' : '', 'age' : 24, 'location' : 'US', 'name' : 'John', 'description' : 'Long Text'}, 
{'image' : '1.jpg', 'title' : 'Title', 'url' : '', 'age' : 24, 'location' : 'US', 'name' : 'John', 'description' : 'Long Text'}
]
Run Code Online (Sandbox Code Playgroud)

请注意包装变量名称的引号.这使代码无法正常工作.

Mat*_*all 5

第一个是包含对象文字的JavaScript 数组文字.不是 JSON.

第二个也是包含对象的数组文字.这是接近JSON,但不是100%有效,因为JSON要求所有的字符串是双引号.例如,这是有效的JSON:

[{"image": "1.jpg", "title": "Title" }]
Run Code Online (Sandbox Code Playgroud)

如果您不确定自己是否在查看有效的JSON,可以随时通过JSONLint运行它并亲自查看.