Is it possible that function will get a parameter that can be int OR char?
In C++ you can create a template function. (The ArduinoJson [] operator is a template too.)

#include &lt;ArduinoJson.h&gt;

StaticJsonDocument&lt;512&gt; tempJDOC;

template &lt;typename T&gt;
void setValue(const char *key, T value){
  tempJDOC[key] = value;
}

void setup() {
  Serial.begin(115200);

  setValue("a", 5);
  setValue("b", "xyz");

  serializeJson(tempJDOC, Serial);
}

void loop() {
}


the compiler will create function based on this template for every different type you use as second parameter in your sketch