python-解开嵌套的json

发布于 2025-01-29 06:40:14 字数 662 浏览 4 评论 0原文

我有以下问题:我无法解开“嵌套的json”

来获取此数据集,我使用以下代码:

 a = pd.json_normalize(variavel, max_level=5)
 a

嵌套的json

看最后一列“ node.phases_history”。那是嵌套的Json。无论我使用多少级别,我都无法拆开它。

因此,我试图用嵌套的JSON将列标准化。

pd.json_normalize(a['node.phases_history'])

而且,无论我设置了多少级别,它也不起作用。

而且,当我尝试它时:

pd.json_normalize(a['node.phases_history'][1])

nested json_2

它起作用,但仅适用于单个注册表。

有人知道我可以解决它,以及如何自动化它,无论添加了多少列?

I have the following problem: I can not unpack a "Nested JSON"

To obtain this dataset, I used the following code:

 a = pd.json_normalize(variavel, max_level=5)
 a

Nested JSON

Take a look at the last column "node.phases_history". That's the nested json. No matter how many levels I use, I not being able to unpack it.

So, I tried to normalize the column with the nested JSON.

pd.json_normalize(a['node.phases_history'])

And it also does not work, again, no matter how many levels in the max_level I set.

And, when I try it:

pd.json_normalize(a['node.phases_history'][1])

Nested JSON_2

It works, but only for a single registry.

Anyone knows can I solve it, and how I can automate it, no matter how much columns are added?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文