update a Key wherever it present in given JSON #213
-
Is it possible to update a key wherever it is present, irrespective of the structure of JSON?
output:
jslt template used:
Is there a more elegant way of doing this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
This is an interesting feature suggestion, but I'm afraid there is no support for anything like this at the moment. However, you can get what you want by writing a recursive traversal function that does the update on every object in the input. You can see some useful examples here https://github.com/schibsted/jslt/blob/master/tutorial.md#function-declarations |
Beta Was this translation helpful? Give feedback.
This is an interesting feature suggestion, but I'm afraid there is no support for anything like this at the moment.
However, you can get what you want by writing a recursive traversal function that does the update on every object in the input. You can see some useful examples here https://github.com/schibsted/jslt/blob/master/tutorial.md#function-declarations