Function cJSON_AddItemToObjectCS

Synopsis

#include <cJSON.h>

cJSON_bool cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item)

Description

Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before writing to item->string

Add an item to an object with constant string as key

Mentioned in

Source

Lines 2050-2053 in cJSON.c. Line 227 in cJSON.h.

CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item)
{
    return add_item_to_object(object, string, item, &global_hooks, true);
}





Add Discussion as Guest

Log in