Hi,
For a week I have been searching for a way to deal with the values sent by JSON in a separate manner, but I didn't find the solution: Im using code in this link: https://randomnerdtutorials.com/esp32-client-server-wi-fi/
and I change it to be suitable with what i need.
as a string and I need to deal with each value as a separate value. I used this code but is not helpful , how can I received it as int array and add number for each value?
if(WiFi.status()== WL_CONNECTED ){
temperature = httpGETRequest(serverNameTemp);
char str_array[temperature.length()];
temperature.toCharArray(str_array, temperature.length());
char* token = strtok(str_array, " ");
int value = token.toInt();
value+=3
It's not helpful because it doesn't even compile. Might have been worth mentioning.
Are we talking about an ESP controller? In that case (not in the case of an AVR Arduino) use the String class. It has the indexOf() method that helps tokenizing (together with substring()) and it offers the toInt() method.
There are dozens. Many probably not ideal for your task, even binary is possible if you insist only on WiFi but not on HTTP, although even HTTP offers the binary option.
I already sent you some example code. It works for a correctly formatted JSON array but doesn't detect errors. As you don't provide details, this code should work for you.