in src/Serializer/NDJsonSerializer.php [55:74]
public static function unserialize(string $data, array $options = [])
{
$array = explode(strpos($data, "\r\n") !== false ? "\r\n" : "\n", $data);
$result = [];
foreach ($array as $json) {
if (empty($json)) {
continue;
}
try {
$result[] = JsonSerializer::unserialize($json, $options);
} catch (JsonException $e) {
throw new InvalidJsonException(sprintf(
"Not a valid NDJson: %s",
$e->getMessage()
));
}
}
$type = $options['type'] ?? 'array';
return $type === 'array' ? $result : new ArrayObject($result);
}