wellsjo / JSON-Splora

GUI app for editing, visualizing, and manipulating JSON data
MIT License
1.86k stars 60 forks source link

node-jq throws E2BIG error when input json is too big #39

Closed qifuren1985 closed 7 years ago

qifuren1985 commented 7 years ago

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:

  1. pass json to node-jq from a temp file
  2. 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.
wellsjo commented 7 years ago

For now, we can use the file option for node-jq, perhaps in conjunction with something like https://github.com/bruce/node-temp