json parsing using gsm sim800l and arduino uno r3

hi everyone
it me nischal ...i m getting some problem regarding json data parsing using arduino and gsm module with module number sim800l. complete code to parse json data from url mentioned in code is shown in attached images. also i have attached respective output that appeared on serial monitor of arduino IDE software. for clear understanding i have point out error which are listed below.

  1. when i make comment in line number 69 and 70 shown in attached figure 1, then i got successfully parsed data of id and engine igintion value.... output of this is attached number 3

  2. when i make all free(uncomment) then all parsed data that is output becomes null(0) and sometimes it gives error as parsed fail...for this output is shown in attached figure 4

  3. i tried to find errors and get some little hints as

please help me :frowning: little help will be appreciated

[code]#include <SoftwareSerial.h>
SoftwareSerial http(11, 12);
#include <ArduinoJson.h>
String apn = "ntnet";
void setup()
{
  //StaticJsonBuffer<200> jsonBuffer;
  Serial.flush();
  http.begin(4800);
  Serial.begin(9600);
  http.println("AT+IPR=4800");
  http.println("ATE0");
  http.println("AT+CTZU=1\r\n ");
  delay(500);
  //printSerialData();
  http.println("AT+CCLK?\r\n");
  delay(500);
  printSerialData();
  http.println("AT+CREG?");
  delay(500);
  printSerialData();
  http.println("AT+SAPBR=3,1,Contype,GPRS");
  delay(800);
  printSerialData();
  //printSerialData();
  http.println("AT+SAPBR=3,1,APN," + apn);
  delay(800);
  printSerialData();
  http.println("AT+SAPBR =1,1");
  delay(800);
  printSerialData();
  http.println("AT+SAPBR=2,1");
  delay(800);
  printSerialData();
  http.println("AT+HTTPINIT");
  delay(800);
  printSerialData();
  http.println("AT+HTTPPARA=?");
  printSerialData();
  http.println("AT+HTTPPARA=CID,1");
  delay(800);
  printSerialData();
  http.println("AT+HTTPPARA=URL, amc.trenzynepal.com/wp-json/wp/v2/device/3828");
  delay(2000);
  printSerialData();
  http.println("AT+HTTPACTION=0");
  delay(5000);                                  //variable for no data recieve
  printSerialData();
  Serial.println("....................................................\n");
  http.println("AT+HTTPREAD");
  delay(9000);
  String data = http.readString();
  int len = data.length();
  data.remove(0, 17);
  Serial.println(len);
  data.remove(len - 23, 22);
  Serial.println(data);
  const size_t capacity = JSON_OBJECT_SIZE(4) + 70;
  DynamicJsonBuffer jsonBuffer(capacity);
  JsonObject& root = jsonBuffer.parseObject(data);
  delay(5000);
  if (!root.success())
  {
    Serial.print("failed");
    return;
  }
  int id = root["id"]; // 3828
  bool engine_ignition = root["engine_ignition"]; // true
    bool engine_start = root["engine_start"]; // true
  bool head_light = root["head_light"]; // true
  //  Serial.print(".............data.................................................");
  //  Serial.print("\n");
  Serial.print("device id: ");
  Serial.println(id);
  Serial.flush();
  // Serial.print("\n");
  Serial.print("engine ignition state: ");
  Serial.println(engine_ignition);
  Serial.print("\n");
  Serial.flush();
  //   Serial.print("engine start state: ");
  //    Serial.println(engine_start);
  //  //  //  Serial.print("\n");
  //  //   Serial.print("head light state: ");
  //  Serial.println(head_light);
  Serial.print("..................completed......................................");
}
/*********************************************************************************************************************************************************
                                                                  loop
***********************************************************************************************************************************************************/
void loop()
{

}
/*********************************************************************************************************************************************************
                                                                function for disply AT command echo
***********************************************************************************************************************************************************/
void printSerialData()
{
  while ((http.available()) != 0)
    Serial.write(http.read());
}

[/code]

complete code to parse json data from url mentioned in code is shown in attached images

The compiler was NOT given a bunch of screenshots to decipher. Don't expect us to decipher your screenshots, either.

  Serial.flush();
  http.begin(4800);
  Serial.begin(9600);

You haven't a clue what flush() does, do you? RTFM, and find out. Then get rid of the call, or explain just why you need to wait for the outgoing serial buffer to be empty before you set the baud rate to be used to empty the buffer.

You are pissing away resources using the String class. Stop doing that.

The IDE is warning you that you don't have a lot of memory available at run time (345 bytes), and yet you seem to think that that is plenty to parse a JSON string. Why do you think that?

You COULD free up a fair amount of memory be keeping your string literals out of SRAM by wrapping them in the F() macro.

http.println(F("AT+IPR=4800"));

tq buddy ..I made the changes as per ur suggestion, I got exact data..
Thanks for the fast responses and willingness to help!