From dfc5fd64c314b4cc879422d3b7892facfbeacd63 Mon Sep 17 00:00:00 2001 From: Tom van Dijck Date: Wed, 24 May 2017 15:31:53 -0700 Subject: [PATCH] Add json.encode_pretty wrapper. --- src/base/jsonwrapper.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/base/jsonwrapper.lua b/src/base/jsonwrapper.lua index 57d4aa9b..0a2518e1 100644 --- a/src/base/jsonwrapper.lua +++ b/src/base/jsonwrapper.lua @@ -33,6 +33,18 @@ return result end + function json.encode_pretty(value) + err = nil + + local success, result = pcall(implementation.encode_pretty, implementation, value) + + if not success then + return nil, err + end + + return result + end + function json.decode(value) err = nil