qntfy / kazaam

Arbitrary transformations of JSON in Golang
MIT License
283 stars 54 forks source link

String interpolation and static strings with shift operation #96

Open timothyj-splunk opened 5 years ago

timothyj-splunk commented 5 years ago

Great work here! Is there a way to build strings (ala go fmt.Sprintf or other interpolation) in the shift operation? Something simpler that concat.

I'm looking for a mix of "value" fields (that preserve the selected values' type) and "interpolated string fields" (that are always strings and may be simple static strings).

Like this perhaps:

Transform (note the '):

{
  "outputField": [ "'some-prefix-", "input.value" ]
}

Input:

{
  "input": { "value": 47 }
}

Output:

{
  "outputField": "some-prefix-47"
}