PHPackages                             simtabi/json-objects - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. simtabi/json-objects

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

simtabi/json-objects
====================

Extract objects from large JSON files, endpoints or streams while saving memory.

012PHP

Since Mar 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/simtabi/json-objects)[ Packagist](https://packagist.org/packages/simtabi/json-objects)[ RSS](/packages/simtabi-json-objects/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

JSON Objects
============

[](#json-objects)

[![Author](https://camo.githubusercontent.com/fffbc89ca2742dccf8be167716e04b7125a913abae0da6a488131999dab8ca25/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d617574686f72266d6573736167653d6365726265726f393026636f6c6f723d353041424631266c6f676f3d74776974746572267374796c653d666c61742d737175617265)](https://twitter.com/cerbero90)[![PHP Version](https://camo.githubusercontent.com/110f3c1d4a31fc7a432074790ee8be2f467a964d2a2fc4d59f7331ad5c1b0831/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6365726265726f2f6a736f6e2d6f626a656374733f636f6c6f723d253233344635423933266c6f676f3d706870267374796c653d666c61742d737175617265)](https://www.php.net)[![Build Status](https://camo.githubusercontent.com/60eef28c54c773b0e2f563413c687254cf54149db7faf6e0fa207fe20777b8ff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6365726265726f39302f6a736f6e2d6f626a656374732f6275696c643f7374796c653d666c61742d737175617265266c6f676f3d676974687562)](https://github.com/cerbero90/json-objects/actions?query=workflow%3Abuild)[![Coverage Status](https://camo.githubusercontent.com/ee7be7a6462d8c13c4c7eb89e78698d7e4e33cdb025b73e68010326f5230b53d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6365726265726f39302f6a736f6e2d6f626a656374732e7376673f7374796c653d666c61742d737175617265266c6f676f3d7363727574696e697a6572)](https://scrutinizer-ci.com/g/cerbero90/json-objects/code-structure)[![Quality Score](https://camo.githubusercontent.com/bdb2ff46bb8934af2470c75759ec325d1d8a7250b3b3139ae9e1b72671b97e1b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6365726265726f39302f6a736f6e2d6f626a656374732e7376673f7374796c653d666c61742d737175617265266c6f676f3d7363727574696e697a6572)](https://scrutinizer-ci.com/g/cerbero90/json-objects)[![Latest Version](https://camo.githubusercontent.com/ba32755b7d5008f3f316205cdc1970130a7a08a31c93a5297a855f3fd93dbfe3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6365726265726f2f6a736f6e2d6f626a656374732e7376673f6c6162656c3d76657273696f6e267374796c653d666c61742d737175617265)](https://packagist.org/packages/cerbero/json-objects)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![PSR-7](https://camo.githubusercontent.com/6fb7c9a2ea9df36409e75d99da4cf1f64aa28a57e3d03a8c0b769d72e6d31fe6/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d636f6d706c69616e6365266d6573736167653d5053522d3726636f6c6f723d626c7565267374796c653d666c61742d737175617265)](https://www.php-fig.org/psr/psr-7/)[![PSR-12](https://camo.githubusercontent.com/9ba5754b3504e97a10e2b2f84770a218e69e544e9de8943eceb0b67599c83c6c/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d636f6d706c69616e6365266d6573736167653d5053522d313226636f6c6f723d626c7565267374796c653d666c61742d737175617265)](https://www.php-fig.org/psr/psr-12/)[![Total Downloads](https://camo.githubusercontent.com/08f084876c194e2924b6069438dda559521064bab48d6ebe7471391593e181ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6365726265726f2f6a736f6e2d6f626a656374732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cerbero/json-objects)

This package extracts JSON objects from large JSON sources like files, endpoints and streams while saving memory. It parses heavy JSONs by using [JsonStreamingParser](https://github.com/salsify/jsonstreamingparser) and provides an easy API to declare what objects to extract and process.

Install
-------

[](#install)

Via Composer

```
composer require simtabi/json-objects
```

Usage
-----

[](#usage)

Simply 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()`:

```
$source = 'https://jsonplaceholder.typicode.com/users';

// Create a new instance specifying the JSON source to extract objects from
new JsonObjects($source);
// or
JsonObjects::from($source);

// Create a new instance specifying the JSON source and the key to extract objects from
new JsonObjects($source, 'address.geo');
// or
JsonObjects::from($source, 'address.geo');
```

When 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`.

Under the hood `JsonObjects` supports PSR-7, hence any implementation of [MessageInterface](https://github.com/php-fig/http-message/blob/master/src/MessageInterface.php) or [StreamInterface](https://github.com/php-fig/http-message/blob/master/src/StreamInterface.php) is a valid source. This makes interactions with other packages supporting PSR-7 (e.g. Guzzle) even more convenient:

```
$response = $guzzle->get('https://jsonplaceholder.typicode.com/users');

// Create a new instance by passing an implementation of MessageInterface
JsonObjects::from($response);

// Create a new instance by passing an implementation of StreamInterface
JsonObjects::from($response->getBody());
```

Finally 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:

```
// Extract and process one object at a time from the given JSON source
JsonObjects::from($source)->each(function (array $object) {
    // Process one object
});

// Extract and process a chunk of objects at a time from the given JSON source
JsonObjects::from($source)->chunk(100, function (array $objects) {
    // Process 100 objects
});
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Andrea Marco Sartori](https://twitter.com/cerbero90)
- [JsonStreamingParser](https://github.com/salsify/jsonstreamingparser)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e606811f3653a5a5a2a0bc39e2cfd2d52436e7f73da3e416dd13284c7ac87f0a?d=identicon)[simtabi](/maintainers/simtabi)

### Embed Badge

![Health badge](/badges/simtabi-json-objects/health.svg)

```
[![Health](https://phpackages.com/badges/simtabi-json-objects/health.svg)](https://phpackages.com/packages/simtabi-json-objects)
```

###  Alternatives

[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[appsero/client

Appsero Client

25431.7k9](/packages/appsero-client)[parfaitementweb/filament-country-field

Country dropdown with ISO 3166 options values

19155.0k1](/packages/parfaitementweb-filament-country-field)[mandango/mondator

Easy and flexible class generator for PHP

1917.9k3](/packages/mandango-mondator)[marvinlabs/laravel-html-font-awesome

A fluent html builder for Font Awesome icons

151.7k](/packages/marvinlabs-laravel-html-font-awesome)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
