Function cJSON_AddNullToObject

Synopsis

#include <cJSON.h>

cJSON * cJSON_AddNullToObject(cJSON *const object, const char *const name)

Description

Helper functions for creating and adding items to an object at the same time. They return the added item or NULL on failure.

Mentioned in

Source

Lines 2075-2085 in cJSON.c. Line 264 in cJSON.h.

CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name)
{
    cJSON *null = cJSON_CreateNull();
    if (add_item_to_object(object, name, null, &global_hooks, false))
    {
        return null;
    }

    cJSON_Delete(null);
    return NULL;
}





Add Discussion as Guest

Log in