How to prevent JSLT removing null & empty properties #235
Replies: 3 comments 4 replies
-
The example is for when you're using the JSLT API directly. If you're working through Camel you need to see how Camel supports it. I guess it's entirely possible you need to add it to Camel yourself. My guess is it's really easy to solve that. |
Beta Was this translation helpful? Give feedback.
-
Hey @larsga what is Reader reader = new Reader() {
@Override
public int read(char[] cbuf, int off, int len) throws IOException {
return 0;
}
@Override
public void close() throws IOException {
}
};
Expression jslt = new Parser(reader)
.withObjectFilter("true")
.compileString(convertModel.getJsltTemplate());
JsonNode output = jslt.apply(convertModel.getJsonInput()); It is not working for me. Can you please help me out |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hi JSLT Team,
I found an a documentation related to this, to use Object Key Filter to prevent this from happening.
https://github.com/schibsted/jslt/blob/master/docs/api.md#object-key-filter
But I am not sure where to put this code:
Expression e = new Parser(reader)
.withObjectFilter(filter)
.parse();
Moreover, I am using Camel to invoke the JSLT transform.
Please throw some light on implementing this.
Beta Was this translation helpful? Give feedback.
All reactions