Advertisement

JSONL to PHP array converter

Convert JSONL to PHP array free in your browser. Paste your JSON Lines on the left, press Convert, and copy clean PHP array on the right. No sign-up, no uploads.

Converter

Paste JSON Lines below, press Convert, and copy the PHP array output.

Advertisement

How JSON Lines becomes PHP array

Each non-empty line is parsed as its own JSON object and treated as one row, so a 10,000-line file is simply 10,000 rows. The converter collects the union of all keys across lines to build the column set, which means ragged objects with different keys still convert cleanly, with blanks where a line lacked a key.

Tips for the PHP output

The snippet assigns $data, so rename the variable or wrap it in a return statement if you are building a config file. It is also a quick way to seed Laravel or WordPress fixtures: convert, paste into a seeder, and the nested array() syntax works on every supported PHP version.

JSONL to PHP array FAQs

What exactly counts as JSON Lines input?
One complete JSON object per line, with no commas between lines and no outer array brackets. Each object becomes one row, and the union of all keys becomes the PHP array columns. Blank lines are ignored, and the tool tells you the exact line number if one line fails to parse.
Is the PHP output valid code I can run?
Yes. It prints a complete <?php snippet assigning $data with classic array() syntax, single-quoted strings with escaping, and null/true/false literals. Paste it straight into any PHP 5.4+ project. Nested values from JSONL fields are rendered as nested arrays.
What about nested objects inside a line?
Nested objects and arrays are kept as compact JSON strings inside their cell, so nothing is dropped. If you need them flattened into dotted columns, convert to JSON first and flatten there; this tool keeps the PHP array one row per line.
Is there a size limit for JSONL input?
No hard limit, but everything runs in your browser tab, so tens of thousands of rows convert in seconds while millions of rows may slow the page. For very large JSONL files, split them into smaller chunks and convert each separately.
Is my JSONL data private, and who uses this?
Yes. The conversion runs 100% in your browser; nothing is uploaded to any server. Developers, analysts and DBAs use it to move JSONL data into PHP array for migrations, reports and config work without installing anything.
Advertisement