the last key was I had seen and then I store the value in the appropriate variable. For the
example from before I would do
1
void ExampleListener::key(String key) {
2
currentKey_ = key;
3
}
4
5
void ExampleListener::value(String key) {
6
if (currentKey_ == "name") {
7
name_ = value;
8
} else if (currentKey_ == "city") {
9
city_ = value;
10
}
11
}
In the stream of the object
the value "name" which we store in currentKey_. Next the parser will detect a value and call
method with the value "Eichhorn". The parser can now make the connection (or
our
value()
create a context) that after the key "name" the value "Eichhorn" should be stored in the
member variable
name_.
"Eichhorn"} we will first get a call to the method key() with
{"name":
Need help?
Do you have a question about the ESP8266 and is the answer not in the manual?