PHPackages                             bim/json-to-table - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. bim/json-to-table

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

bim/json-to-table
=================

JSONPath implementation for querying and updating JSON objects with support for json flattening into a table

2.5(4y ago)214.0k↓30%Apache-2.0PHPPHP &gt;=5.4

Since Apr 17Pushed 3y agoCompare

[ Source](https://github.com/kirill533/Json-To-Flat-Table)[ Packagist](https://packagist.org/packages/bim/json-to-table)[ RSS](/packages/bim-json-to-table/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (8)Used By (0)

JsonPath with support for Flat Table Generation
===============================================

[](#jsonpath-with-support-for-flat-table-generation)

[![Build Status](https://camo.githubusercontent.com/6e8939b20e4422c605a5465f8f0dcdc8fa2f983a734ac6b8b7ade9a6f5fcb6cf/68747470733a2f2f7472617669732d63692e6f72672f47616c6261722f4a736f6e506174682d5048502e737667)](https://travis-ci.org/Galbar/JsonPath-PHP)[![Coverage Status](https://camo.githubusercontent.com/3611ad05a8a67e695f9a751e731c97d7708e831a2034ddb57714a82154431e1c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f47616c6261722f4a736f6e506174682d5048502f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/Galbar/JsonPath-PHP?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/20c3dc344f5ab5d3d9054e9ed9f12bcfb5ae04198d534e309fd3a8766f0255a5/68747470733a2f2f706f7365722e707567782e6f72672f67616c6261722f6a736f6e706174682f762f737461626c65)](https://packagist.org/packages/galbar/jsonpath)[![License](https://camo.githubusercontent.com/4b8eb2aef1d68021246c904a36684f233a65b04ab257216927e2423cdfed5755/68747470733a2f2f706f7365722e707567782e6f72672f67616c6261722f6a736f6e706174682f6c6963656e7365)](https://packagist.org/packages/galbar/jsonpath)

This is a [JSONPath](http://goessner.net/articles/JsonPath/) implementation for PHP.

This implementation features all elements in the specification except the `()` operator (in the spcecification there is the `$..a[(@.length-1)]`, but this can be achieved with `$..a[-1]` and the latter is simpler).

On top of this it implements some extended features:

- Regex match comparisons (p.e. `$.store.book[?(@.author =~ /.*Tolkien/)]`)
- For the child operator `[]` there is no need to surround child names with quotes (p.e. `$.[store][book, bicycle]`) except if the name of the field is a non-valid javascript variable name.
- `.length` can be used to get the length of a string, get the length of an array and to check if a node has children.

Features
========

[](#features)

This implementation has the following features:

- Convert json tree into a flat table using the set of jsonpath stings.

JsonPath Example
================

[](#jsonpath-example)

Consider the following json:

```
{ "store": {
    "name":"My Store",
    "book": [
      { "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95,
        "available": true,
        "authors": ["Nigel Rees"]
      },
      { "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99,
        "available": false,
        "authors": []
      },
      { "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99,
        "available": true,
        "authors": ["Nigel Rees"]
      },
      { "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99,
        "available": false,
        "authors": ["Evelyn Waugh", "J. R. R. Tolkien"]
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95,
      "available": true,
      "model": null,
      "sku-number": "BCCLE-0001-RD"
    },
    "bicycleSet": [{
      "color": "red",
      "price": 19.95,
      "available": true,
      "model": null,
      "sku-number": "BCCLE-0001-RD"
    },{
      "color": "green",
      "price": 19.75,
      "available": false,
      "model": null,
      "sku-number": "RCADF-0002-CQ"
    }]
  },
  "authors": [
    "Nigel Rees",
    "Evelyn Waugh",
    "Herman Melville",
    "J. R. R. Tolkien"
  ],
  "Bike models": [
    1,
    2,
    3
  ]
}

```

JsonPath =&gt; Result
=====================

[](#jsonpath--result)

`[$.store.bicycle.price]`

19.95`[$.store.name,$.store.bicycle.price,$.store.bicycle.sku-number]`

My Store19.95BCCLE-0001-RD`[$.store.book[*].price,$.store.book[*].price,$.store.book[*].authors[*],$.store.book[*].title,$.store.name]`

8.958.95Nigel ReesSayings of the CenturyMy Store12.9912.99nullSword of HonourMy Store8.998.99Nigel ReesMoby DickMy Store22.9922.99Evelyn WaughThe Lord of the RingsMy Store22.9922.99J. R. R. TolkienThe Lord of the RingsMy StoreUsage
=====

[](#usage)

```
$json = '{... your json as string ...}';
$jsonPath = '[$.your.jsonpath.1,$.your.jsonpath.2]';

$jsonObject = new JsonObject($json);
$result = $jsonObject->getTable($jsonPath);
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~18 days

Total

5

Last Release

1745d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/700ac7b222a8c9d077e94925919a89627c435062043c199fa64dd74f7dc533c2?d=identicon)[bim](/maintainers/bim)

---

Top Contributors

[![kirill533](https://avatars.githubusercontent.com/u/6292292?v=4)](https://github.com/kirill533 "kirill533 (12 commits)")[![motanelu](https://avatars.githubusercontent.com/u/70403?v=4)](https://github.com/motanelu "motanelu (8 commits)")[![fayway](https://avatars.githubusercontent.com/u/1507839?v=4)](https://github.com/fayway "fayway (7 commits)")[![SergeyNikolaev](https://avatars.githubusercontent.com/u/5138660?v=4)](https://github.com/SergeyNikolaev "SergeyNikolaev (6 commits)")[![Galbar](https://avatars.githubusercontent.com/u/3595851?v=4)](https://github.com/Galbar "Galbar (5 commits)")[![richardkeen](https://avatars.githubusercontent.com/u/23568?v=4)](https://github.com/richardkeen "richardkeen (2 commits)")[![lksnmnn](https://avatars.githubusercontent.com/u/4983285?v=4)](https://github.com/lksnmnn "lksnmnn (1 commits)")[![javibravo](https://avatars.githubusercontent.com/u/336993?v=4)](https://github.com/javibravo "javibravo (1 commits)")

---

Tags

jsonjsonpathpath

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bim-json-to-table/health.svg)

```
[![Health](https://phpackages.com/badges/bim-json-to-table/health.svg)](https://phpackages.com/packages/bim-json-to-table)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[justinrainbow/json-schema

A library to validate a json schema.

3.6k316.9M612](/packages/justinrainbow-json-schema)[galbar/jsonpath

JSONPath implementation for querying and updating JSON objects

2136.4M78](/packages/galbar-jsonpath)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k135.8M851](/packages/jms-serializer)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[colinodell/json5

UTF-8 compatible JSON5 parser for PHP

30422.2M45](/packages/colinodell-json5)

PHPackages © 2026

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