mirror of
https://github.com/halaxa/json-machine.git
synced 2025-01-17 21:18:23 +01:00
4.2 KiB
4.2 KiB
Changelog
master
Removed
- Removed deprecated functions
objects()
andhttpClientChunks()
. - Removed deprecated
JsonMachine
entrypoint class.
Changed
- Default decoding structure of
Parser
is object. (You don't notice unless you useParser
class directly)
0.8.0
Changed
- Internal decoders moved to
ItemDecoder
.ErrorWrappingDecoder
decorator now requiresItemDecoder
as well.
Deprecated
JsonMachine\JsonMachine
entry point class is deprecated, useJsonMachine\Items
instead.JsonMachine\JsonDecoder\Decoder
interface is deprecated. UseJsonMachine\JsonDecoder\ItemDecoder
instead.
Added
- New entry point class
Items
replacesJsonMachine
. - Object as default decoding structure instead of array in
Items
. Items::getIterator()
now returnsParser
's iterator directly. CallItems::getIterator()
instead ofJsonMachine::getIterator()::getIterator()
to get toParser
's iterator if you need it. Fixes https://stackoverflow.com/questions/63706550Items
usesoptions
in its factory methods instead of growing number of many parameters. See Options in README.Items
introduces newdebug
option. See Options in README.- Noticeable performance improvements. What took 10 seconds in
0.7.*
takes about 7 seconds in0.8.0
.
0.7.1
New features
- PHP 8.1 support
- DEV: Build system switched to composer scripts and Makefile
0.7.0
New features
- Use a
-
in json pointer as a wildcard for an array index. Example:/users/-/id
. Thanks @cerbero90
0.6.1
Fixed bugs
- Empty dict at the end of an item was causing Syntax error in the next item. Reason: closing
}
did not set object key expectation tofalse
. (#41 via PR #42).
0.6.0
New features
- New: Json pointer can find scalar values in JSON document as well as iterable values. See Getting single scalar values
- Parser ends when the end of the desired data is reached and does not heat up the atmosphere further.
- Optimizations: about 15% speed gain.
BC breaks
- A json pointer that matches scalar value does not throw anymore, but the scalar value is yielded in foreach.
0.5.0
New features
- Introduced
FileChunks
class. Takes care of the proper resource management when iterating viaJsonMachine::fromFile()
. It is used internally, and you probably won't come across it. - New
ErrorWrappingDecoder
. Use it when you want to skip malformed JSON items. See Decoders.
BC breaks
StreamBytes
andStringBytes
renamed toStreamChunks
andStringChunks
. These are internal classes, and you probably won't notice the change unless you use them directly for some reason.
0.4.1
New features
- Tracking of parsing progress
0.4.0
New features
- Decoders
- PHP 8 support (thanks @snapshotpl)
BC breaks
ext-json
is not required incomposer.json
anymore, because custom decoder might not need it. However built-in decoders depend on it so it must be present if you use them.- All exceptions now extend
JsonMachineException
(thanks @gabimem) - Throws
UnexpectedEndSyntaxErrorException
on an unexpected end of JSON structure (thanks @gabimem) - Function
httpClientChunks()
is deprecated so that compatibility with Symfony HttpClient is not on the shoulders of JSON Machine maintainer. The code is simple and everyone can make their own function and maintain it. The code was moved to examples. - Function
objects()
is deprecated. The wayobjects()
works is that it casts decoded arrays to objects. It brings some unnecessary overhead and risks on huge datasets. Alternative is to useExtJsonDecoder
which decodes items as objects by default (same asjson_decode
).
<?php
use JsonMachine\JsonDecoder\ExtJsonDecoder;
use JsonMachine\Items;
$jsonMachine = Items::fromFile('path/to.json', '', new ExtJsonDecoder);
Therefore no additional casting is required.
- Invalid json object keys will now throw and won't be ignored anymore.
Fixed bugs
- Decoding of json object keys checks for errors and does not silently ignore them.