Is it possible that function will get a parameter that can be int OR char? I'm trying to create a function that enters a key/value into a JSON file.

But, since value can be an int or char, I don't want to create 2 functions for each type.

Is there a way ?

void setValue(char *key, char* value){
        StaticJsonDocument&lt;512&gt; tempJDOC;
        tempJDOC[key]=value;
}


EDIT1

#ifndef myJSON_h
#define myJSON_h

#include "Arduino.h"
#include &lt;ArduinoJson.h&gt;
#include "FS.h"


class myJSON
{
private:
bool _useSerial=false;
char _filename[30];

public:
char *ver="myJSON_v1.1";
myJSON(char *filename, bool useserial=false);

bool file_exists();
bool file_remove();
bool format ();
bool FS_ok();

void saveJSON2file(JsonDocument&amp; _doc);
void readJSON_file(JsonDocument&amp; _doc);

void printJSON(JsonDocument&amp; _doc);
void PrettyprintJSON(JsonDocument&amp; _doc);

const char *getValue (char *key);

template &lt;class T&gt;
void setValue(const char *key, T value);
//void setValue(const char *key, char *value);

};
#endif


EDIT2

#ifndef myJSON_h
#define myJSON_h

#include "Arduino.h"
#include &lt;ArduinoJson.h&gt;
#include "FS.h"

#define LOG_LENGTH 4
#define DOC_SIZE 512

template &lt;class T&gt; // . &lt;---- line added
class myJSON
{
private:
bool _useSerial=false;
char _filename[30];

public:
char *ver="myJSON_v1.1";
myJSON(char *filename, bool useserial=false);

bool file_exists();
bool file_remove();
bool format ();
bool FS_ok();

void saveJSON2file(JsonDocument&amp; _doc);
void readJSON_file(JsonDocument&amp; _doc);

void printJSON(JsonDocument&amp; _doc);
void PrettyprintJSON(JsonDocument&amp; _doc);

const char *getValue (const char *key);
void removeValue(const char *key);
// void setValue(const char *key, char *value); &lt;--- comment out
void updateArray(char* array_key, int val);
void printFile();
void setValue(const char *key, T value); &lt;---- Added

};
#endif


and in .cpp file :

void myJSON::setValue(const char *key, T value){
        StaticJsonDocument&lt;512&gt; tempJDOC;
        myJSON::readJSON_file(tempJDOC);
        tempJDOC[key]=value;
        myJSON::saveJSON2file(tempJDOC);
        myJSON::PrettyprintJSON(tempJDOC);
}
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