Standalone JSON package
PHP JSON & NDJSON Library for Streaming Data Workflows
Use the standalone MNB PHPExcel JSON package for JSON arrays, workbook-shaped documents, JSON Lines and NDJSON pipelines that need normalized rows, streaming, stable columns, or API-ready output.
Composer
composer require mnb/mnb-phpexcel-json:^2.0- Package
mnb/mnb-phpexcel-json- Entry API
Mnb\PHPExcel\Format\Json- Runtime
- PHP 8.1+
- Format
- .json / .jsonl / .ndjson
Choose your JSON workflow#
01
Read JSON rows and workbook documentsStream top-level arrays, select workbook-shaped sheets, control columns, and normalize heterogeneous records.
Reading guide →02Write JSON for files or APIsSerialize normalized rows or complete workbook payloads with predictable scalar conversion and formatting options.
Writing guide →03Use NDJSON and structured modesProcess one JSON value per line, stream event-style datasets, and preserve workbook-shaped structures when needed.
NDJSON & structured →04Review package capabilitiesSee document modes, streaming limits, normalization behavior, and writer options in one focused matrix.
Feature matrix →Use the right JSON API#
| Task | Primary API | Choose it when |
|---|---|---|
| Read normalized rows | Json::read() | You want a package-local session for arrays, NDJSON, workbook-shaped JSON, headers, projection, or streaming. |
| Write row-oriented JSON | Json::write() | Normalized application rows should become a JSON file with predictable encoding and formatting. |
| Read a workbook-shaped object | JsonReader::readWorkbook() | You need document-level sheet structure rather than only a row session. |
| Return JSON as a string | JsonWriter::payloadToString() | An API response or application layer needs JSON output without writing a file first. |
What the standalone JSON package covers#
Multiple JSON shapes
- Top-level arrays of row objects
- JSON Lines and NDJSON streams
- Workbook-shaped objects with named sheets
- Single-object and nested normalization modes
Bounded row pipelines
- Forward processing for top-level arrays
- One-record-per-line NDJSON iteration
- Stable column controls for heterogeneous records
- Per-record and source-size safety limits
API-ready JSON output
- Row arrays and workbook-shaped payloads
- Pretty printing and zero-fraction preservation
- String output for HTTP/API responses
- Explicit structured modes instead of guessed shapes
Package boundary: this guide uses Mnb\PHPExcel\Format\Json from mnb/mnb-phpexcel-json. Install the focused JSON library or the monolithic mnb/mnb-phpexcel package for a project, not both.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue