summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-07-25 10:49:31 +0200
committerGitHub <noreply@github.com>2021-07-25 10:49:31 +0200
commit6b11d8cc7373a8d88d09d9c46bc2f33a6643567a (patch)
tree9f2a7c80d385c335339aba2499f512be13a22b3d /core
parentcf8e9fd80ca10087ae0ff32ef109f885d15c038b (diff)
parentdd116d79981d2b765ff394c5edc2ebd11d604e82 (diff)
Merge pull request #50828 from aaronfranke/fix-json-stringify-dict
Fix check for the first key in JSON stringify from Dictionary code
Diffstat (limited to 'core')
-rw-r--r--core/io/json.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 77a6181931..0381b78172 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -121,8 +121,11 @@ String JSON::_stringify(const Variant &p_var, const String &p_indent, int p_cur_
keys.sort();
}
+ bool first_key = true;
for (Variant &E : keys) {
- if (E != keys.front()) {
+ if (first_key) {
+ first_key = false;
+ } else {
s += ",";
s += end_statement;
}