简体   繁体   中英

Rename nested objects in jolt transformation

I've transforming one jso to another json. All looks fine. Except the below scenario.

Input Json:

{
  "v1": 1,
  "v2": {
    "inv1": {
      "Id": 1
    },
    "inv2": "some text"
  }
}

Expected JSON:

{
  "value1": 1,
  "value2": {
    "innervalue1": {
      "value": 1
    },
    "innervalue12": "some text"
  }
}

Can someone please help me to write specs for this transformation?

Try this spec:

[
  {
    "operation": "shift",
    "spec": {
      "v1": "value1",
      "v2":{
        "inv1":{
          "Id":"value2.innervalue1.value"
        },
        "inv2":"value2.innervalue12"
      }
    }
  }
]

Output is:

{
  "value1" : 1,
  "value2" : {
    "innervalue1" : {
      "value" : 1
    },
    "innervalue12" : "some text"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM