Open demonappolyon opened 4 years ago
[ { "operation": "shift", "spec": { "rating": { "primary": { // simple match. Put the value '4' in the output under the "Rating" field "value": "Rating", "max": "RatingRange" }, // match any children of "rating" // Shiftr has a precendence order when matching, so the "" will match "last". // In this case anything that isn't "primary". "": { // &1 means, go up one level and grab that value and substitute it in // in this example &1 = "quality" "max": "SecondaryRatings.&1.Range", "value": "SecondaryRatings.&1.Value", // // We want "quality" to be a value field in the output under // "SecondaryRatings.quality.Id", but "quality" is an input key not an input value. // The "$" operator means use the input key, instead of the input value as ouput "$": "SecondaryRatings.&1.Id" } } } }, { "operation": "default", "spec": { "Range": 5, "SecondaryRatings": { "*": { // Defaut all "SecondaryRatings" to have a Range of 5 "Range": 5 } } } } ]
This is my spec.json file for eg it gives proper o/p in https://jolt-demo.appspot.com/#inception with ratings value and range but in Camel I get only default value for same Input file
I had this problem also. I missed that you need to build an Object from the util methods. I was just passing a string into chainr.transform().
Object inputJSON = JsonUtils.jsonToObject(input.toString());
Object transformedOutput = chainr.transform( inputJSON );
Hi, I have created a jolt filter for my json transformation it works well on https://jolt-demo.appspot.com/#inception but when using in my application it generates null.