PHPackages                             byjg/anydataset-json - 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. byjg/anydataset-json

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

byjg/anydataset-json
====================

JSON abstraction dataset. Anydataset is an agnostic data source abstraction layer in PHP.

6.0.0(7mo ago)38.3k↓21.2%1MITPHPPHP &gt;=8.3 &lt;8.6CI failing

Since Nov 24Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/byjg/php-anydataset-json)[ Packagist](https://packagist.org/packages/byjg/anydataset-json)[ GitHub Sponsors](https://github.com/byjg)[ RSS](/packages/byjg-anydataset-json/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (3)Versions (12)Used By (0)

   sidebar\_key anydataset-json   tags    php

 anydataset

    JSON Dataset Abstraction
========================

[](#json-dataset-abstraction)

JSON abstraction dataset. Anydataset is an agnostic data source abstraction layer in PHP.

[![Sponsor](https://camo.githubusercontent.com/fab14b7f7f475072ada0473f193d6f322561fd4a2958e0cc89910d053347cf27/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d2532336561346161613f6c6f676f3d67697468756273706f6e736f7273266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d306431313137)](https://github.com/sponsors/byjg)[![Build Status](https://github.com/byjg/php-anydataset-json/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/php-anydataset-json/actions/workflows/phpunit.yml)[![Opensource ByJG](https://camo.githubusercontent.com/425c1bbccc0f292bf4d20569ae74a6b2e384fd648f1af8911bc61de9a8dcfc0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e736f757263652d62796a672d737563636573732e737667)](http://opensource.byjg.com)[![GitHub source](https://camo.githubusercontent.com/88e61eb211719144efdd570290a0456b6e13099c2df8d973f1bb43fe33bf0039/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769746875622d736f757263652d696e666f726d6174696f6e616c3f6c6f676f3d676974687562)](https://github.com/byjg/php-anydataset-json/)[![GitHub license](https://camo.githubusercontent.com/2dd06fdb6fa004de60c492e5d101895e8181d7a8c979d04a1343393a7ff5f38b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62796a672f7068702d616e79646174617365742d6a736f6e2e737667)](https://opensource.byjg.com/opensource/licensing.html)[![GitHub release](https://camo.githubusercontent.com/b0df564ed796a61aa3acc6063059c1a2bb0c100254f4fde11ce2c6696c5d6bc2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f62796a672f7068702d616e79646174617365742d6a736f6e2e737667)](https://github.com/byjg/uri/releases/)

See more about Anydataset [here](https://opensource.byjg.com/anydataset).

Concept
-------

[](#concept)

The AnyDataset-Json is an abstraction layer to read a JSON data and transform it into a dataset, and you can manipulate it as a table.

Some features:

- Read a JSON file or string
- Navigate through nested JSON structures using path notation
- Define and extract fields with validation
- Create dynamic fields using closures
- Validate data types (string, int, float, bool)
- Handle required fields and default values

### Basic Example

[](#basic-example)

**example.json:**

```
{
   "menu":{
      "header":"SVG Viewer",
      "items":[
         {
            "id":"Open",
            "metadata":{
               "version":"1",
               "date":"NA"
            }
         },
         {
            "id":"OpenNew",
            "label":"Open New",
            "metadata":{
               "version":"2",
               "date":"2021-10-01"
            }
         }
      ]
   }
}
```

**example.php:**

```
$json = file_get_contents('example.json');

$dataset = new \ByJG\AnyDataset\Json\JsonDataset($json);

// Basic usage with field definitions
$iterator = $dataset->getIterator("/menu/items")
                        ->withFields([
                            \ByJG\AnyDataset\Json\JsonFieldDefinition::create("name", "id"),
                            \ByJG\AnyDataset\Json\JsonFieldDefinition::create("version", "metadata/version")
                                ->required()
                                ->ofTypeString()
                        ]);

foreach ($iterator as $row) {
    echo $row->get('name');       // Print "Open", "OpenNew"
    echo $row->get('version');    // Print "1", "2"
}
```

Features
--------

[](#features)

- [Simple Manipulation](docs/simple.md)
- [Creating dynamic fields](docs/dynamic-fields.md)
- [The JsonFieldDefinition](docs/jsonfielddefinition.md)

Install
-------

[](#install)

```
composer require "byjg/anydataset-json"
```

Running the Unit tests
----------------------

[](#running-the-unit-tests)

```
vendor/bin/phpunit
```

Dependencies
------------

[](#dependencies)

 ```
flowchart TD
    byjg/anydataset-json --> byjg/anydataset
    byjg/anydataset-json --> ext-json
```

      Loading ---

[Open source ByJG](http://opensource.byjg.com)

###  Health Score

54

—

FairBetter than 96% of packages

Maintenance72

Regular maintenance activity

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~284 days

Recently: every ~109 days

Total

10

Last Release

222d ago

Major Versions

4.9.2 → 5.0.x-dev2024-10-27

5.0.0 → 6.0.02025-11-24

PHP version history (4 changes)4.0.0PHP &gt;=5.6.0

4.9.0PHP &gt;=7.4

5.0.x-devPHP &gt;=8.1 &lt;8.4

6.0.0PHP &gt;=8.3 &lt;8.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/981924?v=4)[Joao Gilberto Magalhaes](/maintainers/byjg)[@byjg](https://github.com/byjg)

---

Top Contributors

[![byjg](https://avatars.githubusercontent.com/u/981924?v=4)](https://github.com/byjg "byjg (56 commits)")

---

Tags

anydatasethacktoberfestjsonjson-anydatasetjson-parserphp

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/byjg-anydataset-json/health.svg)

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

PHPackages © 2026

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