case json_type_int:
type = "int";
break;
+ case json_type_double:
+ type = "double";
+ break;
default:
return -1;
}
case json_type_int:
fprintf(stdout, "' %d;\n", json_object_get_int(obj));
break;
+ case json_type_double:
+ fprintf(stdout, "' %lf;\n", json_object_get_double(obj));
+ break;
default:
return -1;
}
new = json_object_new_string(var);
} else if (!strcmp(type, "int")) {
new = json_object_new_int(atoi(var));
+ } else if (!strcmp(type, "double")) {
+ new = json_object_new_double(strtod(var, NULL));
} else if (!strcmp(type, "boolean")) {
new = json_object_new_boolean(!!atoi(var));
} else {
_json_add_generic boolean "$1" "$2"
}
+json_add_double() {
+ _json_add_generic double "$1" "$2"
+}
+
# functions read access to json variables
json_load() {