| 123456789101112131415161718192021222324252627282930313233343536 |
- /*
- * Arduino JSON library
- * Benoit Blanchon 2014 - MIT License
- */
- #include "JsonArray.h"
- #include "JsonObject.h"
- using namespace ArduinoJson::Parser;
- DEPRECATED JsonObject JsonArray::getHashTable(int index)
- {
- return operator[](index);
- }
- /*
- * Returns the token for the value at the specified index
- */
- JsonValue JsonArray::operator[](int index)
- {
- // sanity check
- if (index < 0 || !isArray() || index >= size())
- return null();
- // skip first token, it's the whole object
- JsonToken runningToken = firstChild();
- // skip all tokens before the specified index
- for (int i = 0; i < index; i++)
- {
- // move forward: current + nested tokens
- runningToken = runningToken.nextSibling();
- }
- return runningToken;
- }
|