1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

Add indent and sort keys support for JSON.print

This commit is contained in:
Geequlim
2017-11-03 15:32:58 +08:00
parent c880302754
commit f7168bf217
4 changed files with 46 additions and 19 deletions

View File

@@ -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) {