Closed proffalken closed 2 years ago
Hi @proffalken,
JSON doesn't support hexadecimal values, so ArduinoJson provides no facility to read them. I plan on adding support for JSON5 someday, but I can't give you any time estimate.
If you want to keep your current format, you need to loop through each array and call strtol()
.
Something like this (not tested):
for (const char* hexValue : doc["dev_eui"].as<JsonArray>()) {
long value = strtol(hexValue, NULL, 16);
// store value somewhere...
}
Best regards, Benoit
Fantastic, thanks @bblanchon!
Describe the issue
I have an API that returns data in the following format:
I want to turn this into three
uint8_t
variables stored as byte arrays using the Preferences functionality on an ESP32 device so I can automatically programme devices for LoRaWAN Networks.The lorawan example code shows defining these values as follows:
My code defines them as follows:
So far, I have tried:
but each time I get something along the lines of
Searching around suggests that I should be using copyArray, but I'm using a JSON dict, so I'm struggling to work out the syntax!
Troubleshooter report
Here is the report generated by the ArduinoJson Troubleshooter:
Environment
Here is the environment that I'm using':
Reproduction
See code above.