mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-24 11:54:49 +00:00
Add mg_json_get_long
This commit is contained in:
1 parent
86e57d243d
commit
c5751b0bd3
6 files changed
+42
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user