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:

error: invalid conversion from 'ArduinoJson6100_000::VariantAs<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:

as<char*>() was removed in 6.20 and must now be replaced with as<const char*>()

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