diff --git a/JsonGenerator/JsonHashTableBase.cpp b/JsonGenerator/JsonHashTableBase.cpp index e7d70300..fafd9359 100644 --- a/JsonGenerator/JsonHashTableBase.cpp +++ b/JsonGenerator/JsonHashTableBase.cpp @@ -9,18 +9,18 @@ size_t JsonHashTableBase::printTo(Print& p) const n += p.write('{'); KeyValuePair* current = items; - for (int i = 0; i < count; i++) - { - if (i > 0) - { - n += p.write(','); - } - + for (int i = count; i > 0; i--) + { n += current->key.printTo(p); n += p.write(':'); n += current->value.printTo(p); current++; + + if (i > 1) + { + n += p.write(','); + } } n += p.write('}');