JSON="../../lib/json.js" JSON0="../../lib/json.js -o json-0" echo '{"foo": "bar"}' | $JSON0 -e 'this.foo="baz"' # {"foo":"baz"} echo '{"age": 38}' | $JSON0 -e 'this.age++' # {"age":39} echo '{"one": 1, "two": 2}' | $JSON0 -e 'this.one=undefined' # {"two":2} # DEPRECATED '-E' synonym works too. echo '{"one": 1, "two": 2}' | $JSON0 -E 'this.two=undefined' # {"one":1} echo '' echo '{"one": 1, "two": 2}' | $JSON0 -e 'this.one++' -e 'this.two++' # {"one":2,"two":3} echo '{"one": 1, "two": 2}' | $JSON -e 'this.one++' one # 2 echo '' echo '[{"first":"Trent","last":"Mick"},{"first":"Andrew","last":"Dlugan"}]' \ | $JSON0 -a -e 'this.name=[this.first,this.last].join(" ");this.first=undefined;this.last=undefined' # [{"name":"Trent Mick"},{"name":"Andrew Dlugan"}] echo '' echo '{"foo": "bar"}' | $JSON -e 'foo foo' 2>&1 | grep SyntaxError # SyntaxError: Unexpected identifier