首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JOLT变换条件

JOLT变换条件
EN

Stack Overflow用户
提问于 2019-02-03 19:37:07
回答 1查看 91关注 0票数 0

我有一个这样的json,

代码语言:javascript
复制
{
  "entry": [
    {
      "resource": {
        "id": "car-1",
        "type": "vehicle",
        "color": "red",
        "owner": {
          "ref": "Person/person-1"
        }
      }
    },
    {
      "resource": {
        "id": "car-2",
        "type": "vehicle",
        "color": "blue",
        "owner": {
          "ref": "Person/person-2"
        }
      }
    },
    {
      "resource": {
        "id": "person-1",
        "type": "Person",
        "name": "john"
      }
    },
    {
      "resource": {
        "id": "person-2",
        "type": "Person",
        "name": "wick"
      }
    }
  ]
}

想要把它转换成这样的东西。

代码语言:javascript
复制
[
  {
    "id": "car-1",
    "type": "vehicle",
    "color": "red",
    "ownername": "john"
  },
  {
    "id": "car-2",
    "type": "vehicle",
    "color": "blue",
    "ownername": "wick"
  }
]

资源/所有者/引用类型< -> /id >。对于每辆车,要添加到json中的车主名称。我尝试了各种组合,但都做不到。

任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2019-02-22 09:38:01

这并不意味着要这么做。它用于Json的结构化格式更改,而不是数据依赖的更改。

也就是说,我从后端系统中获取Json,它总是以"A“格式返回,并且我需要始终以"B”格式返回它,而不管实际数据是什么。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54502431

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档