1
0
mirror of https://github.com/halaxa/json-machine.git synced 2025-02-21 06:32:36 +01:00
json-machine/CHANGELOG.md

103 lines
3.4 KiB
Markdown
Raw Normal View History

2020-12-05 15:13:00 +01:00
# Changelog
2020-11-09 12:37:28 +01:00
2020-12-05 15:13:00 +01:00
## master
### Changed
2021-12-21 16:13:39 +01:00
- `JsonMachine` entry point class renamed to `Items`.
- Object as default decoding structure instead of array. Same as the json_decode() default.
- `Items::getIterator()` now returns `Parser`'s iterator directly. Call `Items::getIterator()`
instead of `Items::getIterator()::getIterator()` to get to `Parser`'s iterator. Fixes
2021-12-21 15:28:55 +01:00
https://stackoverflow.com/questions/63706550
### Added
2021-12-16 16:42:32 +01:00
- Debug mode - provides data for position, line and column. Disabled by default.
- Performace touches
2021-12-06 14:33:35 +01:00
<br>
<br>
## 0.7.1
### New features
2021-11-26 23:10:27 +01:00
- PHP 8.1 support
- DEV: Build system switched to composer scripts and Makefile
2021-05-06 13:47:56 +02:00
<br>
<br>
## 0.7.0
### New features
- Use a `-` in json pointer as a wildcard for an array index. Example: `/users/-/id`. Thanks @cerbero90
2021-01-24 20:08:30 +01:00
<br>
<br>
## 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 to `false`. (#41 via PR #42).
<br>
<br>
2021-01-24 20:08:30 +01:00
## 0.6.0
2020-12-15 17:45:37 +01:00
### New features
- **New:** Json pointer can find scalar values in JSON document as well as iterable values. See
[Getting single scalar values](README.md#getting-scalar-values)
- Parser ends when the end of the desired data is reached and does not heat up the atmosphere further.
2021-01-12 21:47:10 +01:00
- Optimizations: about 15% speed gain.
2020-12-08 16:41:49 +01:00
2020-12-15 17:45:37 +01:00
### BC breaks
- A json pointer that matches scalar value does not throw anymore, but the scalar value is yielded in foreach.
2020-12-08 16:41:49 +01:00
<br>
<br>
## 0.5.0
2020-12-05 15:13:00 +01:00
### New features
- Introduced `FileChunks` class. Takes care of the proper resource management when iterating via `JsonMachine::fromFile()`.
It is used internally, and you probably won't come across it.
2020-12-08 16:37:36 +01:00
- New `ErrorWrappingDecoder`. Use it when you want to skip malformed JSON items. See [Decoders](README.md#decoders).
2020-12-05 15:13:00 +01:00
### BC breaks
- `StreamBytes` and `StringBytes` renamed to `StreamChunks` and `StringChunks`.
These are internal classes, and you probably won't notice the change
unless you use them directly for some reason.
2020-11-12 16:16:40 +01:00
<br>
<br>
2020-11-09 12:37:28 +01:00
2020-12-05 15:13:00 +01:00
## 0.4.1
### New features
2020-12-01 20:53:49 +01:00
- Tracking of parsing progress
2020-12-01 20:58:22 +01:00
<br>
<br>
2020-12-05 15:13:00 +01:00
## 0.4.0
### New features
2020-12-08 12:56:58 +01:00
- [Decoders](README.md#decoders)
2020-11-08 12:55:44 +01:00
- PHP 8 support (thanks @snapshotpl)
2020-12-05 15:13:00 +01:00
### BC breaks
2020-11-09 12:37:28 +01:00
- `ext-json` is not required in `composer.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.
2020-11-09 12:24:07 +01:00
- All exceptions now extend `JsonMachineException` (thanks @gabimem)
- Throws `UnexpectedEndSyntaxErrorException` on an unexpected end of JSON structure (thanks @gabimem)
2020-04-17 13:08:40 +02:00
- Function `httpClientChunks()` is **deprecated** so that compatibility with Symfony HttpClient
2020-11-08 12:55:44 +01:00
is not on the shoulders of JSON Machine maintainer. The code is simple and everyone can make their own
2020-04-17 13:08:40 +02:00
function and maintain it. The code was moved to [examples](src/examples/symfonyHttpClient.php).
- Function `objects()` is **deprecated**. The way `objects()` works is that it casts decoded arrays
to objects. It brings some unnecessary overhead and risks on huge datasets.
2020-11-08 12:55:44 +01:00
Alternative is to use `ExtJsonDecoder` which decodes items as objects by default (same as `json_decode`).
2020-04-17 13:08:40 +02:00
```php
<?php
use JsonMachine\JsonDecoder\ExtJsonDecoder;
2021-12-21 16:13:39 +01:00
use JsonMachine\Items;
2020-04-17 13:08:40 +02:00
2021-12-21 16:13:39 +01:00
$jsonMachine = Items::fromFile('path/to.json', '', new ExtJsonDecoder);
2020-04-17 13:08:40 +02:00
```
Therefore no additional casting is required.
2020-04-17 12:43:32 +02:00
- Invalid json object keys will now throw and won't be ignored anymore.
2020-12-05 15:13:00 +01:00
### Fixed bugs
2020-04-17 12:43:32 +02:00
- Decoding of json object keys checks for errors and does not silently ignore them.