Download the PHP package ronolo/json-extract without Composer
On this page you can find all versions of the php package ronolo/json-extract. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ronolo/json-extract
More information about ronolo/json-extract
Files in ronolo/json-extract
Package json-extract
Short Description Extracts JSON from strings and returns PHP arrays.
License MIT
Homepage https://github.com/ronolo/json-extract
Informations about the package json-extract
Json Extractor
Abstract
Small class, which will try to extract JSON strings from a string. There are two functions which will achieve that.
Installation
If that does not work, you may have to add the repository to the top level composer.json like this:
Use
This will expect the identifier somewhere in the given string. The identifier position will act as starting point and the next valid JSON object or array will be returned as PHP array.
This will look for any JSON objects or arrays in the string and returns them as an array of arrays of JSON data. You may have to check the list of JSON data for data you was looking for.
It is recommend to break HTML down into smaller parts with a DOM parser, like symfony/dom-crawler or similar. The smaller the portion is which shall be parsed the better will be the result.
For example, if you parse a HTML string and expect the JSON inside the
... tags, feed only the text inside the tags to the json-extract functions. ## Can extract Correct JSON Incorrect Single-Quotes JSON Javascript Objects (Thanks to the CJSON.php) EOFAll versions of json-extract with dependencies
ext-json Version *