Skip to content
MNB PHPExcelDeveloper Guide
AI
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#

Use the right JSON API#

TaskPrimary APIChoose it when
Read normalized rowsJson::read()You want a package-local session for arrays, NDJSON, workbook-shaped JSON, headers, projection, or streaming.
Write row-oriented JSONJson::write()Normalized application rows should become a JSON file with predictable encoding and formatting.
Read a workbook-shaped objectJsonReader::readWorkbook()You need document-level sheet structure rather than only a row session.
Return JSON as a stringJsonWriter::payloadToString()An API response or application layer needs JSON output without writing a file first.

What the standalone JSON package covers#

Documents

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
Streaming

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
Write

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.