aboutsummaryrefslogtreecommitdiff
path: root/manual.txt
diff options
context:
space:
mode:
Diffstat (limited to 'manual.txt')
-rw-r--r--manual.txt26
1 files changed, 26 insertions, 0 deletions
diff --git a/manual.txt b/manual.txt
index 99681cc..13454be 100644
--- a/manual.txt
+++ b/manual.txt
@@ -158,6 +158,7 @@ setting = cjson.refuse_invalid_numbers([setting])
158depth = cjson.encode_max_depth([depth]) 158depth = cjson.encode_max_depth([depth])
159convert, ratio, safe = cjson.encode_sparse_array([convert[, ratio[, safe]]]) 159convert, ratio, safe = cjson.encode_sparse_array([convert[, ratio[, safe]]])
160keep = cjson.encode_keep_buffer([keep]) 160keep = cjson.encode_keep_buffer([keep])
161depth = cjson.decode_max_depth([depth])
161------------ 162------------
162 163
163 164
@@ -239,6 +240,31 @@ numeric key will be stored as a Lua +string+. Any code assuming type
239+number+ may break. 240+number+ may break.
240 241
241 242
243[[decode_max_depth]]
244decode_max_depth
245~~~~~~~~~~~~~~~~
246
247[source,lua]
248------------
249depth = cjson.decode_max_depth([depth])
250-- "depth" must be a positive integer
251------------
252
253By default, Lua CJSON will reject JSON with arrays and/or objects
254nested more than 20 deep.
255
256This setting is only changed when an argument is provided. The current
257setting is always returned.
258
259When the maximum array/object depth is exceeded Lua CJSON will throw
260an error. An error may be thrown before the depth limit is hit if Lua
261is unable to allocate more objects on the Lua stack.
262
263This check prevents unnecessarily complicated JSON from slowing down
264the application, or crashing the application due to lack of process
265stack space.
266
267
242encode 268encode
243~~~~~~ 269~~~~~~
244 270