1

The problem:

JSON::NestingError: nesting of 101 is too deep

I've tried adding the :max_nesting => 120 to my JSON.parse line with no avail.

Then switched to OJ to see if that would change it.

Any ideas?

4

1 回答 1

1

使用 max_nesting 选项调用 JSON.parse。这个对我有用。

> o = JSON.parse(File.read(Rails.root.join("deep.json")))
JSON::NestingError: nesting of 101 is too deep
> o = JSON.parse(File.read(Rails.root.join("deep.json")),max_nesting: 150)
# { Big ol' deeply nested hash }
于 2014-09-05T16:51:10.780 回答