diff --git a/CHANGELOG.md b/CHANGELOG.md index 602351b..46f0034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Removed - Removed deprecated functions `objects()` and `httpClientChunks()`. - Removed deprecated `JsonMachine` entrypoint class. + +### Changed +- Default decoding structure of `Parser` is object. (You don't notice unless you use `Parser` class directly) +

diff --git a/src/Items.php b/src/Items.php index cc314bc..2f15a74 100644 --- a/src/Items.php +++ b/src/Items.php @@ -61,7 +61,7 @@ final class Items implements \IteratorAggregate, PositionAware $this->bytesIterator ), $this->jsonPointer, - $this->jsonDecoder ?: new ExtJsonDecoder(false) + $this->jsonDecoder ?: new ExtJsonDecoder() ); } diff --git a/src/Parser.php b/src/Parser.php index 66ee96d..47cb593 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -64,7 +64,7 @@ class Parser implements \IteratorAggregate, PositionAware str_replace('~1', '/', $jsonPointerPart) ); }, explode('/', $jsonPointer)), 1); - $this->jsonDecoder = $jsonDecoder ?: new ExtJsonDecoder(true); + $this->jsonDecoder = $jsonDecoder ?: new ExtJsonDecoder(); } /** diff --git a/test/JsonMachineTest/ParserTest.php b/test/JsonMachineTest/ParserTest.php index f00aa8d..fce3f73 100644 --- a/test/JsonMachineTest/ParserTest.php +++ b/test/JsonMachineTest/ParserTest.php @@ -300,12 +300,12 @@ class ParserTest extends \PHPUnit_Framework_TestCase return new Parser(new Lexer(new \ArrayIterator([$json])), $jsonPointer, new ExtJsonDecoder(true)); } - public function testDefaultDecodingStructureIsArray() + public function testDefaultDecodingStructureIsObject() { $items = new Parser(new Lexer(new StringChunks('[{"key": "value"}]'))); foreach ($items as $item) { - $this->assertEquals(['key' => 'value'], $item); + $this->assertEquals((object)['key' => 'value'], $item); } } }