aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/README.md b/README.md
index debe1ae..d2094b1 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,7 @@ Table of Contents
16 * [encode_number_precision](#encode_number_precision) 16 * [encode_number_precision](#encode_number_precision)
17 * [encode_escape_forward_slash](#encode_escape_forward_slash) 17 * [encode_escape_forward_slash](#encode_escape_forward_slash)
18 * [encode_skip_unsupported_value_types](#encode_skip_unsupported_value_types) 18 * [encode_skip_unsupported_value_types](#encode_skip_unsupported_value_types)
19 * [encode_indent](#encode_indent)
19 * [decode_array_with_array_mt](#decode_array_with_array_mt) 20 * [decode_array_with_array_mt](#decode_array_with_array_mt)
20 21
21Description 22Description
@@ -201,6 +202,31 @@ This will generate:
201 202
202[Back to TOC](#table-of-contents) 203[Back to TOC](#table-of-contents)
203 204
205encode_indent
206----------------------------
207**syntax:** `cjson.encode_indent(indent)`
208
209If non-empty string provided, JSON values encoded by `cjson.encode()` will be
210formatted in a human-readable way, using `indent` for indentation
211at each nesting level. Also enables newlines and a space after colons.
212
213Example:
214
215```lua
216local cjson = require "cjson"
217
218cjson.encode_indent(" ")
219print(cjson.encode({ a = 1, b = { c = 2 } }))
220-- {
221-- "a": 1,
222-- "b": {
223-- "c": 2
224-- }
225-- }
226```
227
228[Back to TOC](#table-of-contents)
229
204decode_array_with_array_mt 230decode_array_with_array_mt
205-------------------------- 231--------------------------
206**syntax:** `cjson.decode_array_with_array_mt(enabled)` 232**syntax:** `cjson.decode_array_with_array_mt(enabled)`