Jons format problem how numeric type with single quotes how to remove
How to remove single quotes
$arr =array (' as ' =>1, ' data ' =>array (' ID ' = + $r _id, ' List ' + $ZFC));
Echo Json_encode ($arr, json_force_object);
{
"as": 1,
"Data": {
"ID": "111",
"Needimglist": "1.jpg,2.jpg"
}
}
How to remove the double quotation mark of "111" in ID???
------to solve the idea----------------------
$r _id = 111;
$ZFC = ' 123 ';
$arr =array (' as ' =>1, ' data ' =>array (' ID ' = + $r _id, ' List ' + $ZFC));
------to solve the idea----------------------
Json_pretty_print);
{
"as": 1,
"Data": {
"ID": 111,
"List": "123"
}
}
The double quotes of "111" are the result of your own (string)
That's no way to write.
$arr =array (' as ' =>1, ' data ' =>array (' ID ' = intval ($r _id), ' List ' = $ZFC));
------to solve the idea----------------------
Because it is a character type, there are quotation marks, so you can change it.
$arr =array (' as ' =>1, ' data ' =>array (' ID ' =>intval ($r _id), ' List ' = + $ZFC));
Echo Json_encode ($arr, json_force_object);
------to solve the idea----------------------
$arr =array (' as ' =>1, ' data ' =>array (' ID ' = + $r _id+0, ' List ' + $ZFC));
Echo Json_encode ($arr, json_force_object);