PHPackages                             keboola-legacy/json-parser - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. keboola-legacy/json-parser

Abandoned → [keboola/json-parser](/?search=keboola%2Fjson-parser)Library[PDF &amp; Document Generation](/categories/documents)

keboola-legacy/json-parser
==========================

Keboola JSON to CSV parser

3.0.0(5y ago)02.4k↓66.7%[1 PRs](https://github.com/keboola/legacy-php-jsonparser/pulls)2MITPHPPHP &gt;=7.4CI failing

Since Oct 4Pushed 4y ago15 watchersCompare

[ Source](https://github.com/keboola/legacy-php-jsonparser)[ Packagist](https://packagist.org/packages/keboola-legacy/json-parser)[ RSS](/packages/keboola-legacy-json-parser/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (6)Versions (52)Used By (2)

Json Parser
===========

[](#json-parser)

Description
-----------

[](#description)

Parse Json strings into CSV files Creates multiple tables from a single JSON, if said JSON contains numbered arrays Uses Keboola\\CsvFile for results

Usage
-----

[](#usage)

```
    use Keboola\Json\Parser;
	$parser = Parser::create(new \Monolog\Logger('json-parser'));
	$file = file_get_contents("some/data.json");
	$json = json_decode($file);

	$parser->process($json);

	$results = $parser->getCsvFiles(); // array of CsvFile objects
```

Parser\\Json
============

[](#parserjson)

Analyzes and parses JSON data into n\*CSV files.

create(\\Monolog\\Logger $logger, $struct, $analyzeRows)
--------------------------------------------------------

[](#createmonologlogger-logger-struct-analyzerows)

- $struct should contain an array with results from previous analyze() calls (called automatically by process())
- $analyzeRows determines, how many rows of data (counting only the "root" level of each Json) will be analyzed \[default -1 for infinite\]

process($data, $type, $parentId)
--------------------------------

[](#processdata-type-parentid)

- Expects an array of results as the $data parameter
- $type is used for naming the resulting table(s)
- The $parentId may be either a string, which will be saved in a JSON\_parentId column, or an array with "column\_name" =&gt; "value", which will name the column(s) by array key provided
- Checks whether the data needs to be analyzed, and either analyzes or parses it into `$this->tables[$type]` ($type is polished to comply with SAPI naming requirements)
- If the data is analyzed, it is stored in Cache and **NOT PARSED** until $this-&gt;getCsvFiles() is called

getCsvFiles()
-------------

[](#getcsvfiles)

- returns a list of \\Common\\Table objects with parse results

Parse characteristics
=====================

[](#parse-characteristics)

The analyze function loops through each row of an array (generally an array of results) and passes the row into analyzeRow() method. If the row only contains a string, it's stored in a "data" column, otherwise the row should usually be an object, so each of the object's variables will be used as a column name, and it's value analysed:

- if it's a scalar, it'll be saved as a value of that column.
- if it's another object, it'll be parsed recursively to analyzeRow(), with it's variable names prepended by current object's name
    - example: "parent": { "child" : "value1" } will result into a "parent\_child" column with a string type of "value1"
- if it's an array, it'll be passed to analyze() to create a new table, linked by JSON\_parentId

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor2

2 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 ~48 days

Recently: every ~329 days

Total

48

Last Release

1994d ago

Major Versions

0.2.4 → 1.0.02015-09-27

1.1.0 → 2.0.02017-08-31

2.1.0 → 3.0.02021-01-15

PHP version history (2 changes)0.1.14PHP &gt;=5.4.0

3.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/101dbf2551a0709ddab522f97669f13a2c4cc2d0a1e8d009f3af6ba80accb1a9?d=identicon)[Keboola](/maintainers/Keboola)

---

Top Contributors

[![michaljurecko](https://avatars.githubusercontent.com/u/19371734?v=4)](https://github.com/michaljurecko "michaljurecko (3 commits)")[![MiroCillik](https://avatars.githubusercontent.com/u/1488015?v=4)](https://github.com/MiroCillik "MiroCillik (3 commits)")[![kachnitel](https://avatars.githubusercontent.com/u/4067705?v=4)](https://github.com/kachnitel "kachnitel (2 commits)")[![odinuv](https://avatars.githubusercontent.com/u/4319320?v=4)](https://github.com/odinuv "odinuv (2 commits)")

---

Tags

deprecatedjsonparsercsvconverterjson2csv

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/keboola-legacy-json-parser/health.svg)

```
[![Health](https://phpackages.com/badges/keboola-legacy-json-parser/health.svg)](https://phpackages.com/packages/keboola-legacy-json-parser)
```

###  Alternatives

[faisalman/simple-excel-php

Easily parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc formats

578610.1k1](/packages/faisalman-simple-excel-php)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[mledoze/countries

List of world countries in JSON, CSV, XML and YAML

6.2k733.8k6](/packages/mledoze-countries)[rodenastyle/stream-parser

PHP Multiformat Streaming Parser

447204.3k2](/packages/rodenastyle-stream-parser)[kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

1693.3M36](/packages/kartik-v-yii2-export)[ozdemirburak/json-csv

JSON to CSV and CSV to JSON converters in PHP.

40170.3k1](/packages/ozdemirburak-json-csv)

PHPackages © 2026

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