ESP8266 Developer Zone The Official ESP8266 Forum 2015-08-23T03:25:00+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=726 2015-08-23T03:25:00+08:00 2015-08-23T03:25:00+08:00 https://bbs.espressif.com:443/viewtopic.php?t=726&p=3370#p3370 <![CDATA[Re: Sending/Receiving JSON via UDP/TCP]]> https://github.com/jpenninkhof/esp_mqtt_switch.

If this doesn't get you started, please do let me know. Perhaps I'll just blog about it.

Statistics: Posted by jpenninkhof — Sun Aug 23, 2015 3:25 am


]]>
2015-07-11T18:53:01+08:00 2015-07-11T18:53:01+08:00 https://bbs.espressif.com:443/viewtopic.php?t=726&p=2624#p2624 <![CDATA[Sending/Receiving JSON via UDP/TCP]]>
1) In user init, start a tcp connection and start receiving.
2) Parse incoming data in web server receive and call json_send.
3) Call json_ws_send, this in turn calls the JSON callback function which has set and get methods as defined below:

LOCAL struct jsontree_callback wifi_connect_ap_callback = JSONTREE_CALLBACK(connect_ap_get, connect_ap_set);

JSONTREE_OBJECT(ap_setting, JSONTREE_PAIR("ssid", &wifi_connect_ap_callback), JSONTREE_PAIR("password", &wifi_connect_ap_callback));
JSONTREE_OBJECT(wifi_tree, JSONTREE_PAIR("ap_details", &ap_setting));

But my problem is that json tree callback never calls the connect_ap_set ( which supposedly extracts the values from json tree to variable which I can then use to print on UART) but calls the connect_ap_get twice.

This is where I have run out of luck and haven't made any further headway.

Any simple solution for using JSON (IoT Demo is too complicated for new users) will be much helpful.

Statistics: Posted by paritosharya007 — Sat Jul 11, 2015 6:53 pm


]]>