How to digest JSON data posted by http client to ESP32 Web Server?

Pcborges
Posts: 37
Joined: Thu Aug 09, 2018 9:56 pm

How to digest JSON data posted by http client to ESP32 Web Server?

Postby Pcborges » Mon Oct 07, 2019 9:55 pm

Hi, My ESP32 WebServer sends a HTML page to a client browser. Customer fills the form and submits.
Client browser posts form data using a
var jsonFormInfo = JSON.stringify({ contruct type.

Data arrives at ESP32 Web server as the console printout below.

I am getting all the data I need (SEE BOLD TEXT below), my ESP32webServer gets JSON from a web browser but, so far, I am unable to get to the JSON data on the ESP32 side.

My Problem is:
Get to the JSON data arriving from the browser.

What is displayed at the ESP32 console when submit is clicked at the client browser:

CONSOLE PRINTOUT STARTS HERE:
New Client.
GET /?wifissid=myssid&wifiPass=mypass&delayPrimFoto=&delayEntreFotos=&timeGMT=2&smtpServer=&smtpUser=&smtpPass=&emailto=&emailTitle=&emailMessage=&ftpServer=&ftpUser=&ftpPass= HTTP/1.1
Host: 192.168.4.1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Linux; Android 9; Mi A2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.90 Mobile Safari/537.36 EdgA/42.0.4.3928
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
Referer: http://192.168.4.1/
Accept-Encoding: gzip, deflate
Accept-Language: pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7

Client disconnected.
CONSOLE PRINTOUT ENDS HERE:

Note: most variables came out empty because I only typed wifissid and wifiPass.

By the way:
Related libraries I am using and related commands:
#include <WiFiClientSecure.h>
WiFiServer server(80);

Based on my research I believe I need:
#include "AsyncJson.h"
#include "ArduinoJson.h"
But still do not know how to match the JSON data that arrives from customer browser on it.

Assistance welcome
Paulo

ShimaSh
Posts: 1
Joined: Tue Nov 24, 2020 6:43 am

Re: How to digest JSON data posted by http client to ESP32 Web Server?

Postby ShimaSh » Sat Dec 26, 2020 9:56 am

Hi :))
I'm having the same problem. Were you able to solve it?
If so, could you please tell me how?

Who is online

Users browsing this forum: No registered users and 62 guests