bazaarvoice / jolt

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

Split with pipeline #526

Open zpatrol opened 6 years ago

zpatrol commented 6 years ago

Input:

{
  "value": "firstValue|secondValue"
}

JoltSpec:

[
  {
    "operation": "shift",
    "spec": {
      "value": {
        "*\\|*": {
          "$(0,1)": "1",
          "$(0,2)": "2"
        }
      }
    }
  }
]

Expected:

{
  "1" : "firstValue",
  "2" : "secondValue"
}

It is working well with underline or comma. It's not working with pipeline "|" :

Error running the Transform. JOLT Chainr encountered an exception constructing Transform className:com.bazaarvoice.jolt.Shiftr at index:0.

milosimpson commented 6 years ago

"|" has special meaning in Jolt shift. It looks like the escaping logic isn't catching this path.

muddineni commented 6 years ago

any solution to split string having '|' as seperator??