-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How the Object Key Filter work #370
Comments
By default JSLT omits some values from objects, such as null. By setting the filter you can provide a new rule for what should be omitted. Basically, JSLT omits a value when the filter returns So if the filter is |
With true it is working fine. |
You want the filter to return |
yes that's correct. |
That's good. Can we close this issue now? |
Sorry bit confused. |
The filter says what to keep. So if you say |
But it is not working. if I am passing |
This is my previous comment. It explains why you get an empty JSON:
|
Hi,
We have been using this library and incredibly happy with the results, saves our lot of time in Json transformations.
We have a scenario where it is required not to omit the keys where value is null or empty string.
I found that this can be achieved as explained here -
https://github.com/schibsted/jslt/blob/master/docs/api.md#object-key-filter
Now in the given syntax if I replace the filter with
". == null or . == {} or . == []"
I don't get the desired result, I am getting emply json in the output, when I pass true, I get the expected results. Can you please help me with the correct way how to pass the `. == null or . == {} or . == []' in the filter?JSLT:
Input Json:
Expected Output Json:
The text was updated successfully, but these errors were encountered: