carrascoacd / ArduinoSIM800L

Arduino HTTP & FTP client for SIM800L/SIM800 boards to perform GET and POST requests to a JSON API as well as FTP uploads.
158 stars 58 forks source link

Isolate HTTP JSON data #7

Closed jLynx closed 7 years ago

jLynx commented 7 years ago

Is there a way to Isolate the JSON data? Right now I am getting +HTTPACTION: 1,200,{"hello":true} where all I am wanting is {"hello":true}

Also how do I turn off all the console output from the module?

Thanks

carrascoacd commented 7 years ago

Hi!,

In order to turn off all the console output you have a flag in the HTTP class constructor, the last one: const bool DEBUG = false; const HTTP http(9600, RX_PIN, TX_PIN, RST_PIN, DEBUG);

+HTTPACTION: 1,200,{"hello":true} is the console log you are getting, but the response the library returns is already isolated, for example: http.post("your.api", body, response); with the debug flag=true (that by default is true in the HTTP constructor) will log +HTTPACTION: 1,200,{"hello":true} but the response variable will contain {"hello":true} Check this example where I'm using ArduinoJson to parse JSON data into an object also.

jLynx commented 7 years ago

Awesome! Thanks for the fast reply!