【发布时间】:2012-07-24 08:03:25
【问题描述】:
我有一些类似 Json 的数据爬取了一个 URL
[[["oppl.lr",[,,,,,,,,,,,[[[[[,"A Google User"]
,,,,1]
,3000,,,"Double tree was ok, it wasnt super fancy or anything. Its good for families and just relaxing by the pool. Service was good, and rooms were kept neat.","a year ago",["http://www.ma..",,1],,"","",""]
]
,["Rooms","Service","Location","Value"]
,[]
使用 php json_decode() 函数无法解析。是否有任何库或其他东西可以让我将其转换为常规 json 以便我的任务更容易?否则我知道我必须写正则表达式。
提前致谢。
【问题讨论】:
-
这是一个数组吗?你能正常化吗?表示类似
array(name, array(work, array(something))的意思。因为从您的 OP 中的日期无法有意义地推断出任何内容 -
这就是问题所在......我已经粘贴了我得到的实际数据......我也无法弄清楚它是如何格式化的?
-
它甚至没有正确嵌套。如果您想提取数据,正则表达式是唯一的解决方案。您实际上想从中提取什么?
-
如果 [["oppl.lr",[,,,,,,,,,,,[[,"A Google User"],"",""],""]] ] 是数据......那么有可能吗?我想为我的项目获取这些数据。
-
可能是疯了,但是 Ya 这是一个有效的 javascript 数组:P 尝试
console.log([["oppl.lr",[,,,,,,,,,,,[[,"A Google User"],"",""],""]]])然后你可以使用for..in类型的循环。或json encode相同并将其发送回您的服务器
标签: php javascript json web-crawler