0

I have JSON data. if I dd() the response I can see the complete json, but if I return it as a JSON response the json is braking/partially returned/truncated and also it's not a valid json. Screenshot - end of JSON response.Below is the code I am using

public function getLocations($json = true)
{
    $locations = [
        'countries'     => $this->mobileAppController->getCountries(),
        'states'        => $this->mobileAppController->getStates(),
        'cities'        => $this->mobileAppController->getCities(),
        'regions'       => $this->mobileAppController->getRegions()
    ];
    //dd(response()->json($locations));
    return $json ? response()->json($locations) : $locations;
}

I have a homestead installation. and a staging environment. in local/homestead everything works fine. the response is completely returned. the staging is an envoyer server. There the response is truncated/braking/partially returned. what might be the problem.?

Shobi
  • 10,374
  • 6
  • 46
  • 82
  • If this is a screenshot from browser inspector, sometimes it shows part of JSON if the JSON was huge, So I suggest to check the JSON response from Postman – Ravisha Hesh Oct 18 '17 at 17:37
  • I checked using both postman and ARC also, and I was getting the same response. but to my surprise sometimes it completely displays the full response. will it be some problem with server? – Shobi Oct 19 '17 at 17:24
  • Actually, I never experienced something like this. Did you try to decode the JSON from javascript or something? That way you can ensure it returns a part of the response or not – Ravisha Hesh Oct 19 '17 at 17:41

0 Answers0