Closed
Description
I want to make a function which finds a key by name in a json object it works fine when the value is double, but if the value comes as "130.34" it fails, what i need is a way to determine its type if is coming as string then to convert it to double.
the values may come as directly double or as double but in a string ex. "130.34"
double jfind(json jdata, char* keyName){
auto keytofind = jdata.find(keyName);
// Check if *keytofind is string or numeric ????? how to do it???
if(keytofind != jdata.end()){
return *keytofind;
}else{
return 0;
}
}