madeso / json

A JSON parser for files written by humans
zlib License
0 stars 0 forks source link

Add optional max-depth option when parsing so there aren't any stack overflows #10

Open madeso opened 5 years ago

madeso commented 5 years ago

Currently the array and object parsing is stack based. What does this mean? Given a json file 1.json containing [1] and another 3.json containing [[[3]]] the library currently parses 1000.json without a problem on my test machines but encounters a stack overflow on 1000000.json.

madeso commented 5 years ago

Add optional int to parse that is negative by default. Positive is max depth, negative is infinite. This doesn't change the behavior of existing code.