If input json is big array, it will fail.
for example, type this code in chrome console, it will generate a big array, and copy to clipboard.
function gen_data() { var ret = []; for(var i=0; i < 10000; i++) { ret.push({"name": i , "kk": i * 2}) } return ret; } copy(JSON.stringify(gen_data()));
if we type: .length, it will return 10000
if we type: .[0] | keys, it will fail.
two solution:
pass json to node-jq from a temp file
modify node-jq, when call child_process to create process, pass json to new process from stdin(faster, and no temp file), not command line. I have add a issue to node-jq.
If input json is big array, it will fail. for example, type this code in chrome console, it will generate a big array, and copy to clipboard.
function gen_data() { var ret = []; for(var i=0; i < 10000; i++) { ret.push({"name": i , "kk": i * 2}) } return ret; } copy(JSON.stringify(gen_data()));
if we type: .length, it will return 10000 if we type: .[0] | keys, it will fail.
two solution: