0
I have a REST API that works correctly in my local environment but in production is cutting a portion of the return.
{"status":"sucesso","data":{"return":"Inser\u00e7\u00e3o de lead efetuada com sucesso.
The right thing would be:
{"status":"sucesso","data":{"return":"Inser\u00e7\u00e3o de lead efetuada com sucesso."}}
The error that is being displayed is this:
SyntaxError: JSON.parse: unterminated string at line 1 column 87 of the JSON data
Can anyone tell me why? Must be some configuration on the production server since in the local environment returns correctly.
[EDIT] I’m using Code Igniter, the code that mounts the return is this:
$retorno_api = array(
'status' => 'sucesso',
'data' => array(
'return' => $acao_efetuada.' de lead efetuada com sucesso.')
);
And I return using the response()
of the Igniter Code Rest Controller:
$this->response($retorno_api);
Just analyzing the code to state anything. I can’t imagine any configuration that would interfere with that.
– Woss
I’m using Code Igniter, I’ll include the part of the code that makes the return
– Lucas_SCCP
Post the url, then you can debug directly on the server, or else you can post php!
– Rafael Salomão
Removes the $açao_feita variable, and tests whether the json return comes with the correct closure or instead of using the Answer from the Igniter code, uses php json_encode and tests.
– Rafael Salomão