-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
Hi,
The JsonObject
class turns empty objects into empty arrays and thus is unable to give back the original JSON representation.
For example:
{
"item1": {},
"item2": {}
}
Is returned as:
{
"item1": [],
"item2": []
}
Here is how to reproduce it:
public function test() {
$this->assertEquals('[{"item":"value"}]', (new JsonObject('[{"item":"value"}]'))->getJson());
$this->assertEquals('{"item":"value"}', (new JsonObject('{"item":"value"}'))->getJson());
$this->assertEquals('[]', (new JsonObject('[]'))->getJson());
$this->assertEquals('{}', (new JsonObject('{}'))->getJson()); // FAILS!
}
Failed asserting that two strings are equal.
Expected :'{}'
Actual :'[]'
Best regards,
Metadata
Metadata
Assignees
Labels
No labels