这是什么格式[类似json]

what is this formatting [something like json]?

本文关键字:json 类似 是什么 格式      更新时间:2023-09-26

我想开发一个网站,从空中时间api中读取一些数据。

它生成如下内容:

({"env":"production","schedulerTime":"2012-07-11 14:44:34","previous":{"name":"Written By:Jalale Ale Ahmad-Modire Madrese[audiolib.ir]","starts":"2012-2017-11 09:30:48.228571","ends":00.087571","结束":"2012-07-11 10:31:11.217571","media_item_playered":true,"record":0,"type":"track"},"next":{"name":"编写人:Jalale Ale Ahmad-Modire Madrese[audiolib.ir]","starts":"2012-07-11 10:31:11.217571","ends":,"currentShow":[{"start_timestamp":"2012-07-11 13:58:00","end_timestamp":"201207-11 16:00:00","name":"Untitled Show","id":36,"instance_id":36","record":0,"url":","starts":"01207-11 13:58","end":"2012 07-11 16:0:0"}],"nextShow":[],"时区":"IRDT","时区偏移":"16200","AIRTIME_API_VERSION":"1.0"})

它不是JSON,那是什么?以及如何将其转换为php或javascript数组?

它似乎是有效的JSON。。办理入住手续http://jsonlint.com/...

您可以使用json_decode($output, true); 将其转换为数组

它似乎是json(去掉第一个圆括号)。

你可以使用下面的免费在线工具来验证

http://jsonlint.com/

它肯定是JSON。您只需要跳过数据开头和结尾的圆括号。json_decode PHP函数应该能够为您解码它。

虽然它不是有效的JSON,但它看起来像是带有额外括号的JSON。正如Felix所提到的,它可能是一个没有函数名的JSON-p封装响应。请查看API文档中有关如何提供数据的信息,或者,如果您可以在接收数据后并在将数据传递给JSON.parse之前对其进行后处理,则只需手动删除()