Fix check for the first key in JSON stringify from Dictionary code

This commit is contained in:
Aaron Franke 2021-07-24 21:28:50 -04:00
parent cf8e9fd80c
commit dd116d7998
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
1 changed files with 4 additions and 1 deletions

View File

@ -121,8 +121,11 @@ String JSON::_stringify(const Variant &p_var, const String &p_indent, int p_cur_
keys.sort(); keys.sort();
} }
bool first_key = true;
for (Variant &E : keys) { for (Variant &E : keys) {
if (E != keys.front()) { if (first_key) {
first_key = false;
} else {
s += ","; s += ",";
s += end_statement; s += end_statement;
} }