Skip to content

Commit bf95b62

Browse files
committed
Merge pull request #115883 from Gurvan/master
Make JSON.stringify use compact representation for empty `Dictionary`
2 parents 481b6fc + d234d95 commit bf95b62

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

core/io/json.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ void JSON::_stringify(String &r_result, const Variant &p_var, const String &p_in
155155
ERR_FAIL_MSG("Converting circular structure to JSON.");
156156
}
157157

158+
if (d.is_empty()) {
159+
r_result += "{}";
160+
return;
161+
}
162+
158163
r_result += '{';
159164
r_result += end_statement;
160165
p_markers.insert(d.id());

0 commit comments

Comments
 (0)