2

I have a 9GB JSON file, and importing all of it requires an obscene amount of memory. To circumvent that, I'm want to read in only the JSON attributes I'm interested in.

Right now, I'm running

json_file <- stream_in(file("D:/Shodan/data.json"))

Is there any way I can specify which JSON elements/resulting columns do I want to keep? For instance, the above operation will give me back about 30 columns, with over 700 nested/sub columns (col_a, col_b, col_c, col_c$subcol1, col_c$subcol2, etc.) Is there any way I can specify the operation to only return specific columns/JSON elements like col_a, col_c$subcol2, and so on?

Werner Hertzog
  • 2,002
  • 3
  • 24
  • 36
JsDart
  • 183
  • 13
  • Did you see the `handler=` option on the `?steam_in` help page. That seems like it should help. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. The sample doesn't have to be huge to make it clear what you are trying to do. – MrFlick Apr 18 '19 at 16:22
  • Perhaps [`jqr`](https://cran.r-project.org/web/packages/jqr/index.html) can help. – r2evans Apr 18 '19 at 17:12

0 Answers0