I have a problem returning a very large integer value in JSON type:
{“matricula”: 201737909200976697}
What happens is that in return is bringing 201737909200976700.
This occurs with any large integer like this one with 18 digits, so I wanted to return this value as a string but in JavaScript it is still arriving as numeric value.
How can I do this?
EDIT 1:
From php it looks like this:
array (
0 =>
array (
'mtr_codigo' => '2586',
'aln_nome' => 'JOSÉ FERNANDO REIS',
'mtr_matricula' => '201737909200976697'
),
)
When you get to javascript you are:
[{"mtr_codigo": 2586, "aln_nome": "JOSÉ FERNANDO REIS", "mtr_matricula": 201737909200976700}]
EDIT 2:
In the chrome DevTools in the response part it looks like this:
{"body":[{"mtr_codigo":2586,"aln_nome":"JOS\u00c9 FERNANDO REIS","mtr_matricula":201737909200976697}],"meta":{"output":[]},"status":{"code":200,"phrase":"OK","type":"success"}}
In the preview part it looks like this:
body: [{mtr_codigo: 2586, aln_nome: "JOSÉ FERNANDO REIS", mtr_matricula: 201737909200976700}]
0: {mtr_codigo: 2586, aln_nome: "JOSÉ FERNANDO REIS", mtr_matricula: 201737909200976700}
aln_nome: "JOSÉ FERNANDO REIS"
mtr_codigo: 2586
mtr_matricula: 201737909200976700
meta: {output: []}
status: {code: 200, phrase: "OK", type: "success"}
EDIT 3:
In the delivery method the result was
json_encode($result, JSON_NUMBER_CHECK);
I removed this options parameter and returned the numerical value as string correctly.