json
json copied to clipboard
Would like 'this' set for conditional processing on arrays
I would like to be able to act on each member of an array, in turn, as part of conditional/exec processing. It would be neat if each member of an array could be broken out, inserted into the context as this
, and the resulting filtered/modified array reconstituted.
For example, with a dataset like this:
[
"some text",
"some more text",
"a third string"
]
It would be cool to be able to say:
json -f input_array.json -ga -c "this.match(/some/)"
And receive the output:
[
"some text",
"some more text"
]
@jclulow :+1: Funny, I was just looking for similar functionality.
this can be easily done with underscore-cli just in case anyone is looking for a solution now.