You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Modify JSON.stringify so that it doesn't create unnecessary empty lines from empty arrays
(cherry picked from commit 0a55a32085)
This commit is contained in:
committed by
Yuri Sizov
parent
7e74568709
commit
5a7624e50f
@@ -91,9 +91,12 @@ String JSON::_stringify(const Variant &p_var, const String &p_indent, int p_cur_
|
|||||||
case Variant::PACKED_FLOAT64_ARRAY:
|
case Variant::PACKED_FLOAT64_ARRAY:
|
||||||
case Variant::PACKED_STRING_ARRAY:
|
case Variant::PACKED_STRING_ARRAY:
|
||||||
case Variant::ARRAY: {
|
case Variant::ARRAY: {
|
||||||
|
Array a = p_var;
|
||||||
|
if (a.size() == 0) {
|
||||||
|
return "[]";
|
||||||
|
}
|
||||||
String s = "[";
|
String s = "[";
|
||||||
s += end_statement;
|
s += end_statement;
|
||||||
Array a = p_var;
|
|
||||||
|
|
||||||
ERR_FAIL_COND_V_MSG(p_markers.has(a.id()), "\"[...]\"", "Converting circular structure to JSON.");
|
ERR_FAIL_COND_V_MSG(p_markers.has(a.id()), "\"[...]\"", "Converting circular structure to JSON.");
|
||||||
p_markers.insert(a.id());
|
p_markers.insert(a.id());
|
||||||
|
|||||||
Reference in New Issue
Block a user