Retrieve values of parsing Json Array.

I have been trying to retrieve the values after parsing the following Json array:

for this I have written following code:

#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
const char* ssid = "hotspot";
const char* password = "12345678";
const char* host = "";
void setup()
  delay(100);    // We start by connecting to a WiFi network
 Serial.print("Connecting to ");
 WiFi.begin(ssid, password);

 while (WiFi.status() != WL_CONNECTED)
 Serial.println("WiFi connected");
 Serial.println("IP address: ");
 int value = 0;
void loop()
 Serial.print("connecting to ");
 Serial.println(host); // Use WiFiClient class to create TCP connections
 WiFiClient client;

 const int httpPort = 80;
 if (!client.connect(host, httpPort))
 Serial.println("connection failed");
 // We now create a URI for the request
String url = "/motors/people.json";
 Serial.print("Requesting URL: ");
 Serial.println(url); // This will send the request to the server

 client.print(String("GET ") + url +" HTTP/1.1\r\n" + "Host: " 
+ host + "\r\n" + "Connection: close\r\n\r\n");
 String section="header";
 String line = client.readStringUntil('\r');
 // we’ll parse the HTML body here

 { //headers..
  if (line=="\n") 
  { //skips the empty space at the beginning 
else if (section=="json")
 { // print the good stuff
 String result = line.substring(1);
 // Parse JSON
int size = result.length() + 1;
char json[size];
result.toCharArray(json, size);
StaticJsonBuffer<1000> jsonBuffer;
JsonArray& root = jsonBuffer.parseArray(json);
if (!root.success())
Serial.println("parseObject() failed");

const char* Motor1 = root['JSON'][0];
const char* Motor2 = root['JSON'][1];
const char* Motor3 = root['JSON'][2];
const char* Motor4 = root['JSON'][3];
const char* Valve1 = root['JSON'][4];
const char* Valve2 = root['JSON'][5];
const char* Valve3 = root['JSON'][6];
const char* Valve4 = root['JSON'][7];

 Serial.println("closing connection");

After burning it to ESP, in Serial monitor I am able to see the line received. I am expecting to see the retrieved values after parsing. But after the print the “result” what I get is only a blank space followed by directly with slogan "closing connection. I am expecting to get the retrieved values after parsing on the Serial monitor.
I have attached Snapshot image of the Serial monitor of what I get when I start Serial monitor
I am unable to figure out if my code is right or what changes should I make to get it work, any help please…

 Serial.println(url); // This will send the request to the server

It does not.

Did you look at the examples for the ArduinoJson library? Specifically, the JsonParserExample.ino file? Pay particular attention to the values used as indices in the root array.

You do NOT have anything called JSON, so using that as an index, improperly at that, is not going to get you any data.

Also, single quotes are for single characters. Would you be so kind as to post a picture of your keyboard with the JSON key circled?

Thanks PaulS for your kind response.

Would you be so kind as to post a picture of your keyboard with the JSON key circled?

I did not get what you want to have a look at, but I viewed my Json array in the online tree viewer i am attaching the snapshot of the same for your reference

'JSON' is how you would specify a one character value for a character variable.

"JSON" is how you would specify an array of characters for a char array.

The ArduinoJson library expects the value in the first set of [] to be a string, not a character.

The example that I referred to implies that you should be trying to get the 0th value of the "Motor1" object. I could be wrong. I HATE Json and all the mix of arrays, objects, lists, etc. in an unreadable mess of single quotes, double quotes, and escaped double quotes.

Hi PaulS, greeting and wishes for new year.

Sorry for replying so late. Your idea just worked like wonder. It really helped me to complete my project which was stuck from almost around 4 months. After applying your suggestions I got my problem solved and got busy completing remaining work. Thanks you really helped me .