{"id":18674268,"url":"https://github.com/simtabi/json-objects","last_synced_at":"2025-11-07T01:30:40.602Z","repository":{"id":226450264,"uuid":"768727292","full_name":"simtabi/json-objects","owner":"simtabi","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-07T20:44:49.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-25T12:02:31.745Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simtabi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-07T16:12:35.000Z","updated_at":"2024-03-07T16:24:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"03af8acc-2fe7-481f-9f71-ff11c887f806","html_url":"https://github.com/simtabi/json-objects","commit_stats":null,"previous_names":["simtabi/json-objects"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simtabi%2Fjson-objects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simtabi%2Fjson-objects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simtabi%2Fjson-objects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simtabi%2Fjson-objects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simtabi","download_url":"https://codeload.github.com/simtabi/json-objects/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239515563,"owners_count":19651774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T09:18:14.314Z","updated_at":"2025-11-07T01:30:40.573Z","avatar_url":"https://github.com/simtabi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Objects\n\n[![Author][ico-author]][link-author]\n[![PHP Version][ico-php]][link-php]\n[![Build Status][ico-actions]][link-actions]\n[![Coverage Status][ico-scrutinizer]][link-scrutinizer]\n[![Quality Score][ico-code-quality]][link-code-quality]\n[![Latest Version][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![PSR-7][ico-psr7]][link-psr7]\n[![PSR-12][ico-psr12]][link-psr12]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nThis package extracts JSON objects from large JSON sources like files, endpoints and streams while saving memory. It parses heavy JSONs by using [JsonStreamingParser][link-jsonstreamingparser] and provides an easy API to declare what objects to extract and process.\n\n## Install\n\nVia Composer\n\n``` bash\ncomposer require simtabi/json-objects\n```\n\n## Usage\n\nSimply pass the JSON source (files, endpoints or streams) and optionally the key where objects are contained to create a new instance of `JsonObjects`. You can also call the factory method `from()`:\n\n``` php\n$source = 'https://jsonplaceholder.typicode.com/users';\n\n// Create a new instance specifying the JSON source to extract objects from\nnew JsonObjects($source);\n// or\nJsonObjects::from($source);\n\n// Create a new instance specifying the JSON source and the key to extract objects from\nnew JsonObjects($source, 'address.geo');\n// or\nJsonObjects::from($source, 'address.geo');\n```\n\nWhen providing a key to extract objects from, you can use the dot notation to indicate nested sections of a JSON. For example `nested.*.key` extracts all the objects in the property `key` of every object contained in `nested`.\n\nUnder the hood `JsonObjects` supports PSR-7, hence any implementation of [MessageInterface][link-message-interface] or [StreamInterface][link-stream-interface] is a valid source. This makes interactions with other packages supporting PSR-7 (e.g. Guzzle) even more convenient:\n\n``` php\n$response = $guzzle-\u003eget('https://jsonplaceholder.typicode.com/users');\n\n// Create a new instance by passing an implementation of MessageInterface\nJsonObjects::from($response);\n\n// Create a new instance by passing an implementation of StreamInterface\nJsonObjects::from($response-\u003egetBody());\n```\n\nFinally you can decide whether to extract and process objects one by one or in chunks. The memory will be allocated to read only these objects instead of the whole JSON document:\n\n``` php\n// Extract and process one object at a time from the given JSON source\nJsonObjects::from($source)-\u003eeach(function (array $object) {\n    // Process one object\n});\n\n// Extract and process a chunk of objects at a time from the given JSON source\nJsonObjects::from($source)-\u003echunk(100, function (array $objects) {\n    // Process 100 objects\n});\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email andrea.marco.sartori@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Andrea Marco Sartori][link-author]\n- [JsonStreamingParser][link-jsonstreamingparser]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-author]: https://img.shields.io/static/v1?label=author\u0026message=cerbero90\u0026color=50ABF1\u0026logo=twitter\u0026style=flat-square\n[ico-php]: https://img.shields.io/packagist/php-v/cerbero/json-objects?color=%234F5B93\u0026logo=php\u0026style=flat-square\n[ico-version]: https://img.shields.io/packagist/v/cerbero/json-objects.svg?label=version\u0026style=flat-square\n[ico-actions]: https://img.shields.io/github/workflow/status/cerbero90/json-objects/build?style=flat-square\u0026logo=github\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-psr7]: https://img.shields.io/static/v1?label=compliance\u0026message=PSR-7\u0026color=blue\u0026style=flat-square\n[ico-psr12]: https://img.shields.io/static/v1?label=compliance\u0026message=PSR-12\u0026color=blue\u0026style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/cerbero90/json-objects.svg?style=flat-square\u0026logo=scrutinizer\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/cerbero90/json-objects.svg?style=flat-square\u0026logo=scrutinizer\n[ico-downloads]: https://img.shields.io/packagist/dt/cerbero/json-objects.svg?style=flat-square\n\n[link-author]: https://twitter.com/cerbero90\n[link-php]: https://www.php.net\n[link-packagist]: https://packagist.org/packages/cerbero/json-objects\n[link-actions]: https://github.com/cerbero90/json-objects/actions?query=workflow%3Abuild\n[link-psr7]: https://www.php-fig.org/psr/psr-7/\n[link-psr12]: https://www.php-fig.org/psr/psr-12/\n[link-scrutinizer]: https://scrutinizer-ci.com/g/cerbero90/json-objects/code-structure\n[link-code-quality]: https://scrutinizer-ci.com/g/cerbero90/json-objects\n[link-downloads]: https://packagist.org/packages/cerbero/json-objects\n[link-jsonstreamingparser]: https://github.com/salsify/jsonstreamingparser\n[link-message-interface]: https://github.com/php-fig/http-message/blob/master/src/MessageInterface.php\n[link-stream-interface]: https://github.com/php-fig/http-message/blob/master/src/StreamInterface.php\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimtabi%2Fjson-objects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimtabi%2Fjson-objects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimtabi%2Fjson-objects/lists"}