I'm doing a rest api and i using the cJSON c library in c++.
This is my body request example
{
"userEmail": "email@email.com",
"userPassword": "12345678"
}
In my c++ program i receive this json like this (its work now):
cJSON *root;
root = cJSON_CreateObject();
cJSON_AddStringToObject(root, "userEmail", userEmail.c_str());
cJSON_AddStringToObject(root, "userPassword", userPassword.c_str());
Now i need to change my body request to something like that:
{
"userInfo":{
"userEmail": "email@email.com",
"userPassword": "12345678"
}
}
Note: It is not a array, its like a json 'section'. I dont find any solution to get the content inside "userInfo" (mail and password) using the cJSON library. Can you help me?
Thanks a lot