Skip to content

Commit d888b36

Browse files
committed
feature: add option to sort encoded object keys
1 parent c305d55 commit d888b36

3 files changed

Lines changed: 263 additions & 44 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Table of Contents
1717
* [encode_escape_forward_slash](#encode_escape_forward_slash)
1818
* [encode_skip_unsupported_value_types](#encode_skip_unsupported_value_types)
1919
* [encode_indent](#encode_indent)
20+
* [encode_sort_keys](#encode_sort_keys)
2021
* [decode_array_with_array_mt](#decode_array_with_array_mt)
2122
* [decode_allow_comment](#decode_allow_comment)
2223

@@ -228,6 +229,16 @@ print(cjson.encode({ a = 1, b = { c = 2 } }))
228229

229230
[Back to TOC](#table-of-contents)
230231

232+
encode_sort_keys
233+
---------------------------
234+
**syntax:** `cjson.encode_sort_keys(enabled)`
235+
236+
**default:** false
237+
238+
If enabled, keys in encoded objects will be sorted in alphabetical order.
239+
240+
[Back to TOC](#table-of-contents)
241+
231242
decode_array_with_array_mt
232243
--------------------------
233244
**syntax:** `cjson.decode_array_with_array_mt(enabled)`

0 commit comments

Comments
 (0)