任何人都可以使用 PHP 读取 ning 的 json 导出文件

发布于 2024-09-06 20:26:40 字数 355 浏览 1 评论 0原文

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

([{"id":"2492571:Note:75","contributorName":"16szgsc36qg2k","title":"笔记首页","description":"欢迎!查看所有笔记。","创建日期":"2008-11-14T08:44:58.821Z","更新日期":"2008-11-14T08:44:58.821Z"}])

感谢帮助!

I have a client's JSON files that he got from the NING exporter. I'm trying to load the data into PHP but seems like the json isnt properly formatted or something. SO PHP is not able to parse the JSON. I also used another PHP class to do it but that did not work either. Below is the content of one of the files

([{"id":"2492571:Note:75","contributorName":"16szgsc36qg2k","title":"Notes Home","description":"Welcome! To view all notes.","createdDate":"2008-11-14T08:44:58.821Z","updatedDate":"2008-11-14T08:44:58.821Z"}])

Help appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

沙沙粒小 2024-09-13 20:26:40

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

The parens at the beginning and end are not valid in JSON. It should parse after stripping those.

油饼 2024-09-13 20:26:40

NING 导出器中的 JSON 文件格式不正确。由于某种原因,缺少一些逗号,并且您有“}{”模式,而不是“},{”,并且第一个和最后一个字符不正确。

您可以编写一个小例程来预解析文件并修复这些问题以及可能出现的其他一些问题,或者您可以查看此 WordPress 插件的代码 http://wordpress.org/extend/plugins/import-from-ning/ 并复制修复 json 文件的例程。

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.

独闯女儿国 2024-09-13 20:26:40

如果您想将 Ning 数据移动到另一个平台,您可以考虑 Discourse。已经有一个导入器

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

If you'd like to move your Ning data to another platform, you could consider Discourse. There is already an importer for it.

If you don't want to use Discourse, you can still use the (Ruby) importer source code to see how to parse the JSON file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文