v:format.json.encode converts "false" to "{}" on top level #1486
Closed
Description
The current implementation of v:format.json.encode
converts the value false
to {}
, when used on top level. Although the JSON spec allows any value (object, array, true, false, null, numbers) to be on top level. (https://stackoverflow.com/questions/17220924/does-the-top-level-value-in-json-have-to-be-an-array-or-object)
{v:format.json.encode(value: falseVariable)} --> returns {}
{v:format.json.encode(value: trueVariable)} --> returns true
The problem is the following code because empty(false)
evaluates to true
:
vhs/Classes/ViewHelpers/Format/Json/EncodeViewHelper.php
Lines 100 to 102 in ed6b921
If you think this could safely be removed, I could prepare a pull request.
Metadata
Assignees
Labels
No labels