php - how can json_encode() not auto convert string to int -


so have array,

array  (     [0] => array (           [task] => sleeping           [duration] => 2      )     [1] => array (           [task] => eating           [duration] => 1     )  ) 

when json_encode() it, returns

 [{"task":"sleeping","duration":2},{"task":"eating","duration":1}] 

i need be

 [{"task":"sleeping","duration":"2"},{"task":"eating","duration":"1"}] 

is there way how?

the dump shows variable inside array int in first place cast string before pushing inside array


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -