I'm trying to parse the JSON file of a Reddit thread with all it's comments. But when I try to parse the JSON I get a "in `parse': nesting of 20 is too deep " error.
Below is the code i use:
#require 'net/http'
#require 'rubygems'
#require 'json'
@response = Net::HTTP.get(URI.parse("http://www.reddit.com/r/AskReddit/comments/sjm1z/what_is_your_most_useless_talent/.json"))
result = JSON.parse(@response)
Is there anyway I can get around this?
It is not essential for me to have all the smaller subthreads parsed. Is there a way to set the nesting depth limit?
Try setting the max_nesting value:
result = JSON.parse(@response, :max_nesting => 100)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With