Parse empty object

This commit is contained in:
Benoit Blanchon
2014-10-21 21:11:30 +02:00
parent 0daf82eee2
commit 9c1b6b80aa
8 changed files with 64 additions and 7 deletions

View File

@ -162,6 +162,11 @@ namespace ArduinoJson
return type == JSON_ARRAY;
}
bool isObject()
{
return type == JSON_OBJECT;
}
void addChild(JsonNode* childToAdd);
void removeChild(JsonNode* childToRemove);

View File

@ -33,6 +33,8 @@ namespace ArduinoJson
inline bool isEnd();
inline bool isLong();
inline bool isNull();
inline bool isObjectStop();
inline bool isObjectStart();
inline bool isSpace();
inline void skipOneChar();
@ -42,6 +44,7 @@ namespace ArduinoJson
inline JsonNode* parseBoolean();
inline JsonNode* parseLong();
inline JsonNode* parseNull();
inline JsonNode* parseObject();
inline JsonNode* parseString();
JsonNode *parseDouble();

View File

@ -32,8 +32,8 @@ namespace ArduinoJson
JsonValue createValue();
JsonArray parseArray(char* json);
JsonValue parseValue(char* json);
JsonObject parseObject(char* json);
JsonValue parseValue(char* json); // TODO: remove
protected:
virtual void* allocateNode() = 0;

View File

@ -23,6 +23,11 @@ namespace ArduinoJson
JsonArray createNestedArray(const char* key);
JsonObject createNestedObject(const char* key);
bool success()
{
return _node && _node->isObject();
}
private:
Internals::JsonNode* getOrCreateNodeAt(const char* key);
};