add new function of setValuestringToObject

This commit is contained in:
Alanscut
2020-03-24 22:28:15 +08:00
parent 3ece4c893c
commit 6b35f1c5bc
2 changed files with 27 additions and 0 deletions

View File

@@ -278,6 +278,8 @@ CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * c
/* helper for the cJSON_SetNumberValue macro */
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
/* Only takes effect when type of object is JSON_Object */
CJSON_PUBLIC(char*) cJSON_SetValuestringToObject(cJSON *object, const char *valuestring);
/* Macro for iterating over an array or object */
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)