Add mg_json_get_long

This commit is contained in:
Sergey Lyubka committed 2022-06-30 20:03:29 +01:00
1 parent 86e57d243d
commit c5751b0bd3
6 files changed
+42

No files matched your search

+7
View File
@@ -245,3 +245,10 @@ char *mg_json_get_hex(struct mg_str json, const char *path, int *len) {
}
return result;
}
long mg_json_get_long(struct mg_str json, const char *path, long dflt) {
double dv;
long result = dflt;
if (mg_json_get_num(json, path, &dv)) result = (long) dv;
return result;
}