diff options
| author | Geequlim | 2017-11-03 15:32:58 +0800 |
|---|---|---|
| committer | Geequlim | 2017-11-07 11:52:45 +0800 |
| commit | f7168bf217f810ba7da310953c043448135d0718 (patch) | |
| tree | 0feed4a6cc25f049d248685c4d3b15f2e6c9ec00 /core/bind | |
| parent | c880302754352dce1e44bf00bf9b1ac20e71cd1d (diff) | |
| download | godot-f7168bf217f810ba7da310953c043448135d0718.tar.gz godot-f7168bf217f810ba7da310953c043448135d0718.tar.zst godot-f7168bf217f810ba7da310953c043448135d0718.zip | |
Add indent and sort keys support for JSON.print
Diffstat (limited to 'core/bind')
| -rw-r--r-- | core/bind/core_bind.cpp | 6 | ||||
| -rw-r--r-- | core/bind/core_bind.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 12b892d87..4d6eb92b0 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2669,12 +2669,12 @@ Variant JSONParseResult::get_result() const { } void _JSON::_bind_methods() { - ClassDB::bind_method(D_METHOD("print", "value"), &_JSON::print); + ClassDB::bind_method(D_METHOD("print", "value", "indent", "sort_keys"), &_JSON::print, DEFVAL(String()), DEFVAL(false)); ClassDB::bind_method(D_METHOD("parse", "json"), &_JSON::parse); } -String _JSON::print(const Variant &p_value) { - return JSON::print(p_value); +String _JSON::print(const Variant &p_value, const String &p_indent, bool p_sort_keys) { + return JSON::print(p_value, p_indent, p_sort_keys); } Ref<JSONParseResult> _JSON::parse(const String &p_json) { diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 7f8c734e3..72c20f682 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -714,7 +714,7 @@ protected: public: static _JSON *get_singleton() { return singleton; } - String print(const Variant &p_value); + String print(const Variant &p_value, const String &p_indent = "", bool p_sort_keys = false); Ref<JSONParseResult> parse(const String &p_json); _JSON(); |
