1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00
falk-werner_webfuse-provider/lib/webfuse_provider/impl/util/json_util.c
2020-06-21 21:27:53 +02:00

28 lines
520 B
C

#include "webfuse_provider/impl/util/json_util.h"
int wfp_impl_json_get_int(json_t const * object, char const * key, int default_value)
{
int result = default_value;
json_t * holder = json_object_get(object, key);
if (json_is_integer(holder))
{
result = json_integer_value(holder);
}
return result;
}
wfp_status
wfp_impl_jsonrpc_get_status(
json_t const * error)
{
wfp_status status = WFP_GOOD;
if (NULL != error)
{
status = wfp_impl_json_get_int(error, "code", WFP_BAD_FORMAT);
}
return status;
}