diff --git a/components/json/include/cJSON.h b/components/json/include/cJSON.h index 466d10dbd..92ed8c3b4 100644 --- a/components/json/include/cJSON.h +++ b/components/json/include/cJSON.h @@ -90,6 +90,7 @@ extern cJSON *cJSON_CreateTrue(void); extern cJSON *cJSON_CreateFalse(void); extern cJSON *cJSON_CreateBool(int b); extern cJSON *cJSON_CreateNumber(double num); +extern cJSON *cJSON_CreateDouble(double num,int i_num); extern cJSON *cJSON_CreateString(const char *string); extern cJSON *cJSON_CreateArray(void); extern cJSON *cJSON_CreateObject(void); diff --git a/components/json/library/cJSON.c b/components/json/library/cJSON.c index ab3043711..2a5c39216 100644 --- a/components/json/library/cJSON.c +++ b/components/json/library/cJSON.c @@ -694,6 +694,7 @@ cJSON *cJSON_CreateTrue(void) {cJSON *item=cJSON_New_Item();if(item)item->ty cJSON *cJSON_CreateFalse(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_False;return item;} cJSON *cJSON_CreateBool(int b) {cJSON *item=cJSON_New_Item();if(item)item->type=b?cJSON_True:cJSON_False;return item;} cJSON *cJSON_CreateNumber(double num) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_Number;item->valuedouble=num;item->valueint=(int)num;}return item;} +cJSON *cJSON_CreateDouble(double num,int i_num) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_Number;item->valuedouble=num;item->valueint=i_num;}return item;} cJSON *cJSON_CreateString(const char *string) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_String;item->valuestring=cJSON_strdup(string);}return item;} cJSON *cJSON_CreateArray(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Array;return item;} cJSON *cJSON_CreateObject(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Object;return item;}