From 61ca56fbfc91fca6b792aab3d6b00fe496cede2b Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Thu, 28 Dec 2023 20:30:49 +1100 Subject: [PATCH] additional json.encode options --- library/runtime/json.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/runtime/json.lua b/library/runtime/json.lua index 9e0da1e..fe43828 100644 --- a/library/runtime/json.lua +++ b/library/runtime/json.lua @@ -62,7 +62,16 @@ json.sentinel = json.null ---@class json_encode_state ---When set, the created string will contain newlines and indentation. Otherwise it will be one long line. ---@field indent? boolean +---Alias of indent. +---@field pretty? boolean +---Set `true` to sort the JSON object keys. +---@field sort_keys? boolean ---The initial level of indentation used when indent is set. For each level two spaces are added; when absent it defaults to 0. +---Empty tables encoded as array. +---@field empty_table_as_array? boolean +---Allow tables to be encoded as arrays iff all keys are positive integers, inserting "nil"s when encoding to satisfy the array type. +---@field with_hole? boolean +---Maximum table recursion depth. ---@field indent_amt? integer ---An array to specify the ordering of keys in the encoded output. If an object has keys which are not in this array they are written after the sorted keys. ---@field keyorder? table