jsonstreamingparser | A JSON streaming parser implementation in PHP | Parser library

 by   salsify PHP Version: v8.3.1 License: MIT

kandi X-RAY | jsonstreamingparser Summary

kandi X-RAY | jsonstreamingparser Summary

jsonstreamingparser is a PHP library typically used in Utilities, Parser applications. jsonstreamingparser has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

[License] This is a simple, streaming parser for processing large JSON documents. Use it for parsing very large JSON documents to avoid loading the entire thing into memory, which is how just about every other JSON parser for PHP works. For more details, I’ve written up a longer explanation of the [JSON streaming parser] that talks about pros and cons vs. the standard PHP JSON parser. If you’ve ever used a [SAX parser] for XML (or even JSON) in another language, that’s what this is. Except for JSON in PHP. This package is compliant with [PSR-4] [PSR-1] and [PSR-2] If you notice compliance oversights, please send a patch via pull request. To use the JsonStreamingParser you just have to implement the \JsonStreamingParser\Listener interface. You then pass your Listener into the parser. That’s it! Your Listener will receive events from the streaming parser as it works. There is a complete example of this in example/example.php.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              jsonstreamingparser has a low active ecosystem.
              It has 695 star(s) with 134 fork(s). There are 63 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 9 open issues and 43 have been closed. On average issues are closed in 270 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of jsonstreamingparser is v8.3.1

            kandi-Quality Quality

              jsonstreamingparser has 0 bugs and 0 code smells.

            kandi-Security Security

              jsonstreamingparser has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              jsonstreamingparser code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              jsonstreamingparser is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              jsonstreamingparser releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.
              jsonstreamingparser saves you 503 person hours of effort in developing the same functionality from scratch.
              It has 1183 lines of code, 126 functions and 17 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed jsonstreamingparser and discovered the below as its top functions. This is intended to give you an instant insight into jsonstreamingparser implemented functionality, and help decide if they suit your requirements.
            • Consume a single character .
            • Parse the stream .
            • Start an object .
            • Force the end of the document .
            • Convert a Unicode codepoint to a character .
            • Get the object path .
            • Insert a value into the stack .
            • End the current object .
            • End a complex value
            • Convert string to number
            Get all kandi verified functions for this library.

            jsonstreamingparser Key Features

            No Key Features are available at this moment for jsonstreamingparser.

            jsonstreamingparser Examples and Code Snippets

            No Code Snippets are available at this moment for jsonstreamingparser.

            Community Discussions

            QUESTION

            Read big json file with php
            Asked 2018-Sep-19 at 11:06

            I've read somewhere that I should use the library salsify/jsonstreamingparser to open a big json file but it's giving me the same error as with json_decode:

            ...

            ANSWER

            Answered 2018-Sep-19 at 11:06

            Using the InMemoryListener certainly defeats the purpose of a streaming parser. That'll just unpack everything into memory (likely worse memory-wise than plain json_decode).

            You'll need to catch each JSON object block individually, if you want to work under such constraints.

            There's the SimpleObjectQueueListener which could possibly fit the bill. If the specific JSON has a bunch of [{…}, {…}, {…}] objects to be processed:

            Source https://stackoverflow.com/questions/52395617

            QUESTION

            Parse Large (100MB) JSON with PHP using salsify's JsonStreamerParser in PHPProBid
            Asked 2018-Jul-23 at 17:37

            I have a JSON file:

            ...

            ANSWER

            Answered 2018-Jul-23 at 17:37

            The GeoJSONListener does exactly what you want to do - it keeps the second level of the objects in memory. That way it loads each MLM object in your file by itself - it does not load the complete file into memory.

            Testing out the code you have included on the file you've referenced (and reducing memory limit to 32M, since a streaming parser shouldn't need 4G of memory), it parses through the whole file, reading through 27200 objects before I cancelled the process, in about 10 minutes on an old Macbook.

            This leads me to believe that the problem isn't related to your JSON parser or how you're parsing the file, and can possibly be caused by something else (like your host / web server not honouring calls to set_time_limit or your database layer locking or barfing on some content.

            Source https://stackoverflow.com/questions/51483973

            QUESTION

            Extracting data from large JSON file using php: How can I implement listener interface in my code
            Asked 2017-Oct-04 at 04:15

            I am working with large heavily nested JSON file, and want to use streaming parser by implementing a Listener interface found on jsonstreamingparser. When I ran by php code, I receiced this error: Fatal error: Uncaught Error: Class 'InMemoryListener' not found in C:\xampp\htdocs. I think the error is on line that contains "$listener = new InMemoryListener();". I am new to using stream parser for JSON in PHP. I know what listener interface does is similar to what XMLPARSER does, and some kind of PHP listener interface has been created by some gurus, but I do not know how to implement it in my code. I put the supposed listener interface file named "InMemoryListener" in the same folder as my php code, but I still got error. Can anyone explain how I can implement the Listener interface in my code? Below is my code:

            ...

            ANSWER

            Answered 2017-Oct-04 at 04:15

            When you install something with composer you need to ensure that composer's autoloader is included in your script execution. Add this to the top of your file:

            Source https://stackoverflow.com/questions/46556732

            QUESTION

            How to insert large JSON file to database with PHP
            Asked 2017-Jul-27 at 07:45

            So, I have a large JSON file and I want to insert data from that file to MySQL database. I can only use PHP 5.6 and can't change php.ini file.

            When I'm using json_decode(), I get error, that there is to much memory to allocate. So I searched for some kind of library and I found this library and I'm using it like that:

            ...

            ANSWER

            Answered 2017-Jul-27 at 07:45

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install jsonstreamingparser

            You can download it from GitHub.
            PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/salsify/jsonstreamingparser.git

          • CLI

            gh repo clone salsify/jsonstreamingparser

          • sshUrl

            git@github.com:salsify/jsonstreamingparser.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Reuse Pre-built Kits with jsonstreamingparser

            Consider Popular Parser Libraries

            marked

            by markedjs

            swc

            by swc-project

            es6tutorial

            by ruanyf

            PHP-Parser

            by nikic

            Try Top Libraries by salsify

            goldiloader

            by salsifyRuby

            ember-css-modules

            by salsifyJavaScript

            safer_rails_console

            by salsifyRuby

            avro-builder

            by salsifyRuby

            offline-sort

            by salsifyRuby