-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
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;
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation