bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.54k stars 329 forks source link

Help with splitting of String #1104

Open AkashSrivastava opened 2 years ago

AkashSrivastava commented 2 years ago

Can someone help me with specs for this transformation? Not able to get the split working. Thanks.

Input: { "id": "unique-id", "personDetail" : { "name" : "John Doe", "email" : "emailId" } }

Output: "response": { "firstName": "John", "lastName": "Doe", "email": "emailId" }

avx99 commented 2 years ago
[
  {
    "operation": "shift",
    "spec": {
      "personDetail" : {
        "name" : {
          "* *" : {
            "$(0,1)" : "response.firstName",
            "$(0,2)" : "response.lastName",
            "@(2,email)" : "response.email"
          }
        }
      }
    }
  }
]

Please check this : https://github.com/bazaarvoice/jolt/issues/688 , it's gonna give a clear idea about solving split issues.