ArduinoJson returns keys and values as const char*.

If you try to put these values into a char*, the compiler will issue an error (or a warning) like the following:

invalid conversion from 'ArduinoJson::Internals::JsonVariantAs<char*>::type {aka const char*}' to 'char*' [-fpermissive]

This happens with any of the following expression:

char* sensor = root["sensor"];
char* sensor = root["sensor"].as<char*>();

// in a function whose return type is char*
return root["sensor"].as<char*>();

The solution is to replace char* by const char*

const char* sensor = root["sensor"];
const char* sensor = root["sensor"].as<char*>();

// change the return type of the function
return root["sensor"].as<char*>();

See also:

Global warming stripes by Professor Ed Hawkins (University of Reading)