Json library parseobject() failed error

I was controlling LED from server.
Firstly I was working with www.000webhost.com, it worked fine and I didn't get any error. I controlled LED from remote server. But only the issue was less speed.

So I purchased new server from www.hostinger.com to overcome less speed. But there I m getting parseobject failed error in arduino code.

The same arduino code worked for free server (www.000webhost.com) and its not working for paid server (www.hostinger.com), even i tried with godaddy, there also i m getting the same error.

Any one please in this issue.

String line = client.readStringUntil('\r');
//Serial.print(line);
// we’ll parse the HTML body here
if (section=="header") { // headers..

if (line=="\n") { // skips the empty space at the beginning
section="json";
}
}
else if (section=="json") { // print the good stuff
section="ignore";
String result = line.substring(1);

// Parse JSON
int size = result.length() + 1;
char json;
result.toCharArray(json, size);
StaticJsonBuffer<300> jsonBuffer;
JsonObject& json_parsed = jsonBuffer.parseObject(json);

if (!json_parsed.success())
** {**
** Serial.println("parseObject() failed"); // here my code stucked**
** return;**
** }**

String led = json_parsed["led"][0]["status"];

if(count == 1){
if(led == "on"){
digitalWrite(D1, 1);
delay(100);
Serial.println("D1 is On..!");
}
else if(led == "off"){
digitalWrite(D1, 0);
delay(100);
Serial.println("D1 is Off..!");
}
count = 0;
}

}

The problem is most likely in the code you didn't post.

You get some data from somewhere. You piss away resources storing that data in a String. Then, you uselessly make a copy of the data in the String, as a string. Then, you make another copy of that data in the StaticJsonBuffer.

A very small change in the amount of data returned by the server makes a BIG change in the amount of data that you need to store, since you store three copies of every character.

Quit using Strings, so you only need two copies and NO dynamic memory allocation.