You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want this (as you say your JSON should be like):
"ipv4Address": [ "127.0.0.20" ]
Then the data is an array of one element, so you need a cJSON array object.
If you actually want the brackets to be part of the string (as your title suggests you want), your logic is ok but string constant has an error. Yours is missing the backslash escape for the inner quote characters:
The JSON pair should be like: "ipv4Addresses": ["127.0.0.20"],
I have tried different options but couldn't see the right expected JSON pair
char* vxvcz = "["127.0.0.20"]";
cJSON * ppp = cJSON_CreateString(vxvcz);
// char *out33 = cJSON_Print(ppp);
cJSON_AddItemToObject(data_obj_3, "ipv4Addresses", ppp);
relevant to C in Ubuntu 20.04
Thanks,****
The text was updated successfully, but these errors were encountered: