Assign String to key doesn't work
Created by: dcsoftware
Hi, I run into this issue and I don't know if I am doing something wrong or there is a problem in the library. When I assign a string value to a key in an object, what it is assigned is true value. I have a string received from Serial witch I cut into several substring and them create a json with this data. Here is a sample of my code:
char buff[64];
Serial.readBytesUntil(10, buff, sizeof(buff));
String s = buff;
StaticJsonBuffer<300> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["key"] = s.substring(10, 20); root["key1"] = s.substring(21, 28);
root.printTo(Serial);
The output is: {"key":true,"key1":true}
instead of having my substring it store a "true" value. Same thing happens if I do this:
String a = s.substring(10,20);
root["key"] = a;
Waiting for an answer a in the mean time, Thank very much for your awesome work!!!