Cups to Grams Converter
How many grams in a cup of flour, sugar, butter, rice or 36 more.
A PHP array literal, var_export or print_r output turned into JSON — nothing executed.
Drop a PHP file here, or click to choose one
Converted on your device — the file is never uploaded
The PHP Array to JSON Converter parses PHP array literals, var_export output and print_r output into JSON, keeping types, without executing a single line of PHP.
You are debugging, or reading someone else’s config, and what you have is a PHP array — in a config file, dumped by var_export(), or printed by print_r() in a stack trace. Getting it into a form your tools can read normally means running PHP, which you cannot always do and should never do with code you do not trust.
Paste it here and get JSON, with nothing executed. Array literals with [] or array(), var_export output, and print_r output are all read. Single and double-quoted strings, heredocs, integers in hex, octal and binary, floats, booleans and null all keep their types. Arrays with keys 0, 1, 2 … become JSON arrays and any other keys become objects — exactly what json_encode would do. Function calls such as env('DB_HOST', '127.0.0.1') cannot run in a browser, so they resolve to their default argument, and constants become their names.
[] and array() literals, var_export output, and print_r output.
Hex, octal and binary integers, floats, booleans, null and heredocs all survive.
The text is parsed, never run, so an unknown config file is safe to paste.
A call such as env('DB_HOST', '127.0.0.1') becomes its default value.
Keys 0, 1, 2 … become a JSON array — exactly what json_encode would produce.
A literal, a whole config file with return [ … ];, or print_r output.
JSON arrays for sequential keys, or objects throughout.
Use the default argument, as Laravel config does, or write null.
Indented, minified, or with non-ASCII escaped.
No. The text is parsed, never run, so pasting a config file from an unknown source is safe. That is also why env() and other calls cannot be evaluated.
Yes, including nested arrays and objects. Be aware print_r loses types — every value comes back as a string — so use var_export or the literal when types matter.
Each call becomes its default argument, which is the value the app uses when the environment variable is not set. Switch to null if you would rather see which keys are dynamic.
Because its keys are not 0, 1, 2 … in order. PHP has one array type for both lists and maps; JSON does not, so non-sequential keys must become an object.
What people who use the PHP Array to JSON Converter think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the PHP Array to JSON Converter. It takes half a minute and no account.
Write the first reviewHow many grams in a cup of flour, sugar, butter, rice or 36 more.
Move between percentages, decimals and fractions in any direction.
Convert newtons, kilonewtons, kgf, lbf, dynes and kips in one table.
Make a smaller, royalty-free WebM for the web from any MP4.
YAML back into well-formed XML — lists as repeated tags, @keys as attributes.
Turn a WebM into an MP4 that editors, phones and televisions will actually play.
Convert a CSV export into clean, typed JSON.
Pull the audio out of a video as an MP3 — no upload, no watermark, no limit.