Skip to content

Need more explanation on how to use the library without composer #71

Open
@ghost

Description

I get this error after installing the library with composer:

PHP Fatal error:  Uncaught Error: Class 'JsonStreamingParser\Listener\InMemoryListener' not found in /data/www/default/database/json_to_sql.php:14
Stack trace:
#0 {main}
  thrown in /data/www/default/database/json_to_sql.php on line 14

json_to_sql.php

require_once 'vendor/autoload.php';
$json_file = dirname(__FILE__) . "file.json";

# Load json data from the file into a variable
Line 14 -> $listener = new \JsonStreamingParser\Listener\InMemoryListener();

$stream = fopen($json_file, 'r');
try {
    $parser = new \JsonStreamingParser\Parser($stream, $listener);
    $parser->parse();
    fclose($stream);
} catch (Exception $e) {
    fclose($stream);
    throw $e;
}

$json_data = $listener->getJson();
var_dump($json_data);

I've installed the library with downloading the composer.json file and doing php composer.phar install.

$ php composer.phar diagnose                                              
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: 

  [Symfony\Component\Process\Exception\RuntimeException]
  The Process class relies on proc_open, which is not available on your PHP installation.

diagnose

When I clone the repository it gives me the same error. I don't know if I have to do an include or something, there is no example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions