We already serialize BLOBMSG_TYPE_UNSPEC as "null" so represent JSON null
values as blob attribute type unspec with payload size zero.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
bool ret = true;
void *c;
- if (!obj)
- return false;
-
switch (json_object_get_type(obj)) {
case json_type_object:
c = blobmsg_open_table(b, name);
case json_type_int:
blobmsg_add_u32(b, name, json_object_get_int(obj));
break;
+ case json_type_null:
+ blobmsg_add_field(b, BLOBMSG_TYPE_UNSPEC, name, NULL, 0);
+ break;
default:
return false;
}