File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ Table of Contents
1515 * [ empty_array_mt] ( #empty_array_mt )
1616 * [ encode_number_precision] ( #encode_number_precision )
1717 * [ encode_escape_forward_slash] ( #encode_escape_forward_slash )
18+ * [ encode_skip_unsupported_value_types] ( #encode_skip_unsupported_value_types )
1819 * [ decode_array_with_array_mt] ( #decode_array_with_array_mt )
1920
2021Description
@@ -171,6 +172,35 @@ If disabled, forward slash '/' will be encoded as '/' (no escape is applied).
171172
172173[ Back to TOC] ( #table-of-contents )
173174
175+ encode_skip_unsupported_value_types
176+ ---------------------------
177+ ** syntax:** ` cjson.encode_skip_unsupported_value_types(enabled) `
178+
179+ ** default:** false
180+
181+ If enabled, cjson will not throw exception when there are unsupported types
182+ in the Lua table.
183+
184+ For example:
185+
186+ ``` lua
187+ local ffi = require " ffi"
188+ local cjson = require " cjson"
189+ cjson .encode_skip_unsupported_value_types (true )
190+ local t = {key = " val" }
191+
192+ t .cdata = ffi .new (" char[?]" , 100 )
193+ print (cjson .encode (t ))
194+ ```
195+
196+ This will generate:
197+
198+ ``` json
199+ {"key" :" val" }
200+ ```
201+
202+ [ Back to TOC] ( #table-of-contents )
203+
174204decode_array_with_array_mt
175205--------------------------
176206** syntax:** ` cjson.decode_array_with_array_mt(enabled) `
You can’t perform that action at this time.
0 commit comments