1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Merge pull request #12603 from GodotExplorer/beautify-json

Add indent and sort keys support for JSON.print
This commit is contained in:
Rémi Verschelde
2017-12-06 23:53:05 +01:00
committed by GitHub
4 changed files with 46 additions and 19 deletions

View File

@@ -2694,12 +2694,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) {