Predictable Return Conversion
taufik-nurrohman opened this issue · comments
Global string conversion should be performed only for data in the form of boolean, null, and numbers. JSON data is better to be left as plain text, so the return effect of the conversion is predictable.
Before
$foo = e(['1', 'a', 'true', 'null', '{"foo":1}']); // → `[1, 'a', true, null, ['foo' => 1]]`
// :(
$foo = s([1, 'a', true, null, ['foo' => 1]]); // → `['1', 'a', 'true', 'null', ['foo' => '1']]`
After
$foo = e(['1', 'a', 'true', 'null', '{"foo":1}']); // → `[1, 'a', true, null, '{"foo":1}']`
// :)
$foo = s([1, 'a', true, null, '{"foo":1}']); // → `['1', 'a', 'true', 'null', '{"foo":1}']`
For text data in the form of JSON that comes from a separate page data named *.data
can be converted into array/object later.