JSON from arduino to PHP server
From Wiki2
JSON from arduino to PHP server
Encoding pin values in JSON: <sytaxhighlight>
// last pieces of the HTTP PUT request: client.println("Content-Type: application/json"); client.println("Connection: close"); client.println(); client.print("{"); // here's the actual content of the PUT request: for (int analogChannel = 2; analogChannel < 6; analogChannel++) { int sensorReading = analogRead(analogChannel); String schan = "\""+ sen + analogChannel + "\":"; client.print(schan); client.print(sensorReading); if (analogChannel != 5) { client.print(","); } } client.println("}");
</syntaxhighlight> <sytaxhighlight> </syntaxhighlight> <sytaxhighlight> </syntaxhighlight> <sytaxhighlight> </syntaxhighlight>