Serialize integer values in object

This commit is contained in:
Benoit Blanchon committed 2014-09-30 17:24:14 +02:00
1 parent 27a4d57f7c
commit c1ab55f9d9
3 files changed
+15 -5

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ struct JsonNode
{
bool asBoolean;
double asDouble;
int asInteger;
long asInteger;
const char* asString;
struct
+12 -2
View File
@@ -108,11 +108,21 @@ size_t JsonObject::printTo(Print& p) const
for (JsonNode* child = firstChild; child; child = child->next)
{
const char* childKey = child->content.asKey.key;
const char* childValue = child->content.asKey.value->content.asString;
JsonNode* childValue = child->content.asKey.value;
n += EscapedString::printTo(childKey, p);
n += p.write(':');
n += EscapedString::printTo(childValue, p);
switch (childValue->type)
{
case JSON_STRING:
n += EscapedString::printTo(childValue->content.asString, p);
break;
case JSON_INTEGER:
n += p.print(childValue->content.asInteger);
break;
}
if (child->next)
{