0

我有一个客户从 NING 导出器获得的 JSON 文件。我正在尝试将数据加载到 PHP 中,但似乎 json 格式不正确或其他内容。所以 PHP 无法解析 JSON。我还使用了另一个 PHP 类来做到这一点,但这也不起作用。以下是其中一个文件的内容

([{"id":"2492571:Note:75","contributorName":"16szgsc36qg2k","title":"Notes Home","description":"欢迎!查看所有笔记。","createdDate": "2008-11-14T08:44:58.821Z","updatedDate":"2008-11-14T08:44:58.821Z"}])

帮助表示赞赏!

4

3 回答 3

2

The JSON file from NING exporter is not properly formatted. For some reason, some commas are missing and you have '}{' pattern, instead of '},{' and the first and the last char is not correct.

You can write a small routine to pre-parse the file and fix those problems and some others that might appear or you can take a look at the code of this Wordpress plugin http://wordpress.org/extend/plugins/import-from-ning/ and copy the routine that fix the json file.

于 2011-11-17T11:48:00.817 回答
2

开头和结尾的括号在 JSON 中无效。它应该在剥离这些之后解析。

于 2010-06-23T08:22:58.000 回答
0

如果你想将你的 Ning 数据移动到另一个平台,你可以考虑 Discourse。它已经有一个进口商

如果你不想使用 Discourse,你仍然可以使用(Ruby)导入器源代码来查看如何解析 JSON 文件。

于 2016-09-16T16:50:48.400 回答