We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello
i am using cJSON keil library but i facing many problem to create object and convert object into string.
1. This code work fine
int main(void){
root = cJSON_CreateObject();
cJSON_AddNumberToObject(root, "w", 1920); cJSON_AddNumberToObject(root, "h", 1080);
//cJSON_AddNumberToObject(root, "f", 24); // This line is commented
cJSON_AddBoolToObject (root, "i",1);
char *string = cJSON_Print(root);
while (1) {
HAL_UART_Transmit(&huart3,(uint8_t *)string , strlen(string),HAL_MAX_DELAY);
HAL_Delay(500);
}
the above code work fine but when i uncomment the commented line (cJSON_AddNumberToObject(root, "f", 24);) , after that i did't get any value in string, i found null in string.
and also when i create two object than also i got null in both object's strings.
Can any please tell me why i am facing these problems.