Releases: keboola/php-jsonparser
Releases · keboola/php-jsonparser
4.0.0
3.0.0
Fixes an error retrieving header if the data is `[null]`
A NoDataException
is thrown if [null]
is passed to process()
to prevent an error retrieving structure details (headers) for such data. An array of multiple nulls will still fail.
Fix: Arrays of null where data is expected now parses properly
If Struct::autoUpgradeToArray() is enabled, an array of null values would create an arrayOfNULL
type in the structure, incompatible with any other array, so no non-null values could appear in such array.
-
Example:
[ { "runId": [ null ]}, { "runId": [ "value" ]} ]
This array would previously fail as incompatible. Now the first is simply ignored.
Fix an exception on empty data
Throw NoDataException
if the data type is unknown and an empty set is passed to Parser::process()
Fixed on the fly analysis in Parser::parse() "spam"
- Only analyze data in
parse()
if they're really unknown - less data than what's being parsed
Struct fix
- fix:
Struct::load()
now throws a correct exception if the array structure is wrong - feat:
getArrayType()
has moved fromAnalyzer
toStruct
and is now public
Major rewrite for better maintainability & bugfixes
- Removed
arrayStringMix
, replaced withautoUpgradeToArray
, which supports arrays of objects. - Added check preventing mixing of scalar and object values in an array.
- Added Struct and Analyzer classes that take care of the data analysis and storage of structure.
- Struct::load() now checks integrity of the structure on load
- Arrays in the Struct now contain their type (eg.
arrayOfinteger
) - In a non-strict mode (default), all scalars are now identified as
scalar
from their initial analysis, not when a mismatch is encountered.