forked from bblanchon/ArduinoJson
More test on object parsing
This commit is contained in:
@ -211,7 +211,12 @@ JsonNode* JsonParser::parseObject()
|
||||
|
||||
for(;;)
|
||||
{
|
||||
node->addChild(parseObjectKeyValue());
|
||||
JsonNode* keyValueNode = parseObjectKeyValue();
|
||||
|
||||
if (!keyValueNode)
|
||||
return 0;
|
||||
|
||||
node->addChild(keyValueNode);
|
||||
|
||||
skipSpaces();
|
||||
|
||||
@ -229,6 +234,9 @@ JsonNode* JsonParser::parseObjectKeyValue()
|
||||
{
|
||||
const char* key = QuotedString::extractFrom(_ptr, &_ptr);
|
||||
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
skipSpaces();
|
||||
|
||||
if (!isColon())
|
||||
|
@ -10,7 +10,6 @@ void JsonWriter::writeString(char const* value)
|
||||
|
||||
void JsonWriter::writeInteger(long value)
|
||||
{
|
||||
|
||||
_length += _sink->print(value);
|
||||
}
|
||||
|
||||
@ -21,5 +20,5 @@ void JsonWriter::writeBoolean(bool value)
|
||||
|
||||
void JsonWriter::writeDouble(double value, int decimals)
|
||||
{
|
||||
_length += _sink->print(value, decimals);
|
||||
_length += _sink->print(value, decimals);
|
||||
}
|
@ -91,7 +91,6 @@ char* QuotedString::extractFrom(char* input, char** endPtr)
|
||||
if (c == 0)
|
||||
{
|
||||
// premature ending
|
||||
*endPtr = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -108,7 +107,7 @@ char* QuotedString::extractFrom(char* input, char** endPtr)
|
||||
}
|
||||
|
||||
*writePtr++ = c;
|
||||
}
|
||||
}
|
||||
|
||||
// end the string here
|
||||
*writePtr = 0;
|
Reference in New Issue
Block a user