chokes on some json with -d attempted
paul-hammant opened this issue · comments
wget http://www.reddit.com/r/test/comments/pb42s/test_title.json
cat test_title.json | jshon -d body_html
... chokes with ....
parse error: illegal index on arg 2, "body_html"
cat test_title.json | jshon -t
array
You can't delete a string key from an array, arrays use numerical indexes. Of course it fails.
OK, I get it, thanks. I think the XPath way of addressing nodes might help here. I'd want to kill body_html wherever it is. Here's my workaround:
cracks knuckles
#!/bin/sh
for file in .json; do perl -p -e 's/"body_html": "(?:[^\"]|.)",//g' < "${file}" | jshon | sponge "${file}"; done