Comments (3)
Not quite. It can do:
"foods" : [ "Salad", "Fish", "Shellfish", "Vegetarian" ]
Jolt is about transforming the JSON structure of your data, not "transforming" / running arbitrary logic on the content of your data.
As such, it can put your data into a JSON Array, but it can't run a String concatenation on it.
I created a unit test (for Chainr) with this transform. You can see the spec to generate the "foods" array here :
{
"input": {
"food_pairing": [
{
"food_id": "7",
"food_name": "Salad"
},
{
"food_id": "12",
"food_name": "Fish"
},
{
"food_id": "13",
"food_name": "Shellfish"
},
{
"food_id": "19",
"food_name": "Vegetarian"
}
]
},
"spec": [
{
"operation" : "shift",
"spec" : {
"food_pairing": {
"*": {
// put the Json value found at input key "food_name",
// under the output key "foods" where the JSON value at "foods" is an array
"food_name": "foods[]"
}
}
}
}
],
"expected": {
"foods" : [ "Salad", "Fish", "Shellfish", "Vegetarian" ]
}
}
I hope that helps.
from jolt.
Thanks for replying, that is how I did it a whle ago. I saw it on the documentation. I accomplished the concatenation using Jackson's ObjecNode.
from jolt.
Cool.
from jolt.
Related Issues (20)
- Split the value and fetch by index HOT 2
- How to generate unique id in Jolt HOT 3
- how to add conditions under modify-overwrite-beta HOT 9
- Creating an array HOT 1
- Split items from nested arrays into individual objects HOT 2
- Convert boolean values to int HOT 2
- Need to add an attribute : "includeEmpResponse": true, to the input JSON structure in an array for a particular element using Jolt's spec HOT 5
- Merging two arrays using one common key HOT 1
- How to define customised Functions HOT 3
- Splitting a string which is inside an array of objects HOT 3
- How to display output in specific order (kind of sort or set fields/objects in specific order) HOT 3
- Define additional value in array based on key HOT 4
- Merge sub-arrays having the same main items HOT 2
- handling null values on different key
- Add Value to every List Entry HOT 2
- inquiry on conditional statements - 2 or more object validation at the same time HOT 2
- remove null from simple type array
- ifElse multiple conditions? HOT 2
- Demo site source code
- Input JSON lost when doing a date concat
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jolt.