从“不正确”的地方获取信息Deluge 中的 JSON
我在使用 Zoho Analytics API 提供的 JSON 时遇到一些问题。当您查阅表格时,JSON 的格式不正确,我无法获取 Deluge 中的所有信息。
JSON 是这样的。当ID不为空时,后面的与其相关但ID为空。我想获得与 Deluge 中该 ID 相关的总和。例如,对于 Product1,我想将前三个总数相加。
我尝试在 Deluge 中使用 for every ,但我无法确定何时是新的“数据组”
{
"ID":"81921000005496719",
"Name":"Product1",
"Total":"110.00"
},
{
"ID":"",
"Name":"",
"Total":"94.00"
},
{
"ID":"",
"Name":"",
"Total":"44.00"
},
{
"ID":"81921000005496749",
"Name":"Product2",
"Total":"150.00"
},
{
"ID":"",
"Name":"",
"Total":"322.00"
},
{
"ID":"",
"Name":"",
"Total":"84.00"
},
I am having a bit of trouble with a JSON provided by Zoho Analytics API. When you consult a table, the JSON is not well formed and I am not able to get all the info in Deluge.
The JSON is this way. When ID is not empty, the next ones are related to it but they have ID empty. I want to get the Total sum related to that ID in Deluge. For example, for Product1 I want to sum the first three total.
I tried with a for each in Deluge but I am not able to identify when is a new "data group"
{
"ID":"81921000005496719",
"Name":"Product1",
"Total":"110.00"
},
{
"ID":"",
"Name":"",
"Total":"94.00"
},
{
"ID":"",
"Name":"",
"Total":"44.00"
},
{
"ID":"81921000005496749",
"Name":"Product2",
"Total":"150.00"
},
{
"ID":"",
"Name":"",
"Total":"322.00"
},
{
"ID":"",
"Name":"",
"Total":"84.00"
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基于您当前的 JSON 数据。您可以将前 3 个总数相加。我修改第一个答案,代码应该是
结果是
您可以在 https://dre 中测试这些脚本。 zoho.com/tryout
谢谢,
冯
Based on your current JSON data. you can sum the first 3 totals. I modify the first answer and the code should be
And the result is
You can test these script in https://dre.zoho.com/tryout
Thanks,
Von
Deluge List 不保证以相同的 JSON 顺序排序。您必须更改 Analytics 查询以包含相关行的相同名称或 ID,以便您可以轻松地循环数据。
The Deluge List does not guarantee to be ordered in the same JSON order. You have to change the Analytics query to include the same Name or ID for the related lines, so you can easily loop over the data.