G
GoTool

PHP → JSON

Convert PHP print_r/var_dump/var_export output to JSON

Input0
Examples:
Output
0

About PHP to JSON Converter

Convert PHP debug function output (print_r, var_dump, var_export) to standard JSON format. Developers frequently use these functions to inspect arrays and objects during PHP debugging. This tool quickly converts that output into structured JSON data. All processing happens locally in your browser.

Frequently Asked Questions

What PHP output formats are supported?

Five formats are supported: print_r's Array ( [key] => value ) format, var_dump's typed format (e.g., string(5) "hello"), var_export's PHP syntax format, var_export's __set_state object format, and PHP serialize() format. The tool auto-detects the input type.

Can it handle nested arrays and objects?

Yes, it recursively parses deeply nested arrays and objects, including PHP Object type output.

How are booleans handled in print_r output?

PHP's print_r displays true as 1 and false as an empty string. The tool converts 1 to true and keeps empty values as empty strings.