Hi,
I assuming that you are using Adafruit_GPS library and then you created an object called “GPS to obtain latitudeDegrees
and longitudeDegrees
which are float type.
So I think that maybe there is still some issue with your JSON
I don’t have Adafruit GPS module but I was able to make some test after modifying your createEventPayload()
function
void createEventPayload(int temp, float longi, float lati)
{
//JsonWriterStatic<256> jw;
char data[] = "{\"temp\":%d,\"gps\":{\"lat\":%f,\"lon\":%f},\"lat\":%f,\"lon\":%f}";
char finall[sizeof(data) + 32];
snprintf(finall, sizeof(finall), data, temp, lati, longi, lati, longi);
Particle.publish("Test_data", finall, 60, PRIVATE);
}
I just call the function like this
createEventPayload(32, 52.0764, 54.1765)
; for testing JSON
but you can do it like this:
createEventPayload(32, GPS.longitudeDegrees, GPS.latitudeDegrees);
and the output looks like one of yours above and is valid JSON format