Skip to content
Search
DSL · Json

from_json

Definition

/**
 * @param Path|string $path - string is internally turned into stream
 * @param ?string $pointer - if you want to iterate only results of a subtree, use a pointer, read more at https://github.com/halaxa/json-machine#parsing-a-subtree - @deprecate use withPointer method instead
 * @param null|Schema $schema - enforce schema on the extracted data - @deprecate use withSchema method instead
 */
from_json(Path|string $path, ?string $pointer, ?Schema $schema) : JsonExtractor

Usage examples

<?php

declare(strict_types=1);

use function Flow\ETL\Adapter\JSON\from_json;
use function Flow\ETL\DSL\{data_frame, to_output};

require __DIR__ . '/vendor/autoload.php';

data_frame()
    ->read(from_json(__DIR__ . '/data/orders.json'))
    ->collect()
    ->write(to_output(truncate: false))
    ->run();

Contributors

Built in the open.

Join us on GitHub
scroll back to top