Hi im getting this error " exit status 1 expected '}' before ':' token "
my error code is
String json = { "deviceDefault@2017idp2group9": "deviceDefault@FAVORIOT", "data": {"light":"ON"} } ;
im getting this code from
Im sorry because this my first time post so i dont know proper way to post this problem.
Hope u guys can help me thank you.
You should pot the code that is giving the error here as described in #7 of this "how to use this forum-please read " sticky.
Also copy the entire error message and post it here like described in the sticky. There is information in the error message that will help find and fix the error that you left out in the original post.
You seem to be trying to include quotation marks inside a String
If that really is what you want to do then you need to "esacpe" the quote marks in the String like this
String json = { "deviceDefault@2017idp2group9\": \"deviceDefault@FAVORIOT\", \"data\": {\"light\":\"ON\"}" } ;
void setup()
{
Serial.begin(115200);
Serial.println(json);
}
void loop()
{
}
But is that what you want/need to do I wonder ?
system
April 10, 2018, 11:55am
4
zulfizie:
Hi im getting this error " exit status 1 expected '}' before ':' token "
my error code is
String json = { "deviceDefault@2017idp2group9": "deviceDefault@FAVORIOT", "data": {"light":"ON"} } ;
im getting this code from
https://iotworld.co/2017/05/01/create-your-first-iot-application-by-connecting-arduino-to-favoriot-platform/
Im sorry because this my first time post so i dont know proper way to post this problem.
Hope u guys can help me thank you.
The code in that link uses
String json = "{\"device_developer_id\":\""+DEVICE+"\",\"data\":{\"Light\":\""+txt+"\"}}";
which doesn't look anything like your statement. Theirs compiles. Yours doesn't. Coincidence? I don't think so.
A helpful macro:
#define JSON_STR(...) #__VA_ARGS__
String json = JSON_STR( { "deviceDefault@2017idp2group9": "deviceDefault@FAVORIOT", "data": {"light":"ON"} } );
==>
String json = "{ \"deviceDefault@2017idp2group9\": \"deviceDefault@FAVORIOT\", \"data\": {\"light\":\"ON\"} }";