bazaarvoice / jolt

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

how to transform json from lower snake case to lower camel case? #1103

Open VIPJoey opened 3 years ago

VIPJoey commented 3 years ago

The input such like this

{
  "tag_info": [
    {
      "tag_name": "Commodity specifications",
      "tag_value": [
        "75ml",
        "100ml"
      ]
    }
  ]
}

Expected output:

{
  "tagInfo": [
    {
      "tagName": "Commodity specifications",
      "tagValue": [
        "75ml",
        "100ml"
      ]
    }
  ]
}

thanks.

jqureshi73 commented 2 years ago

[ { "operation": "shift", "spec": { "tag_info": { "*": { "tag_name": "tagInfo[#2].tagName", "tag_value": "tagInfo[#2].tagValue" } } } } ]

VIPJoey commented 2 years ago

[ { "operation": "shift", "spec": { "tag_info": { "*": { "tag_name": "tagInfo[#2].tagName", "tag_value": "tagInfo[#2].tagValue" } } } } ]

It seems that can use the way if there are fewer fields