void ToyControl::init(char* json) { JsonParser<32> parser; JsonArray root = parser.parse(json); if (!root.success()) { HTTP_DEBUG_PRINTLN("JsonParser.parse() failed"); return; } else { if (root.size() == 0) { return; } id = String((char*)root[0]["id"]); battleId = String((char*)root[0]["battle_id"]); toyDeviceId = String((char*)root[0]["toy_device_id"]); type = String((char*)root[0]["type"]); HTTP_DEBUG_PRINT("id: "); HTTP_DEBUG_PRINTLN(id); HTTP_DEBUG_PRINT("battleId: "); HTTP_DEBUG_PRINTLN(battleId); HTTP_DEBUG_PRINT("toyDeviceId: "); HTTP_DEBUG_PRINTLN(toyDeviceId); HTTP_DEBUG_PRINT("type: "); HTTP_DEBUG_PRINTLN(type); } }
inline JsonVariant::JsonVariant(const JsonArray &array) { if (array.success()) { _type = Internals::JSON_ARRAY; _content.asArray = const_cast<JsonArray *>(&array); } else { _type = Internals::JSON_UNDEFINED; } }