JSON to PHP
Convert JSON data into PHP array code, with array and object syntax
输入 JSON 数据
实时转换为 PHP 数组代码
输出格式
PHP 代码输出
About this tool
The JSON to PHP tool turns JSON data into PHP array code:
- Array syntax: standard
['key' => 'value']output - Object syntax: optionally emit stdClass objects
- Indentation: 2 or 4 spaces
- PHP tag: optionally prepend
<?php - Highlighting: keys, strings and numbers use different colors
- Nesting: deep structures are handled correctly
When to use it
- Turn an API sample into a PHP config file
- Generate PHP code from JSON data
- Convert data between front end and back end
- Speed up PHP development
JSON and PHP types
| JSON | PHP |
|---|---|
| object | array (associative) |
| array | array (indexed) |
| string | string |
| number | int or float |
| true/false | true or false |
| null | null |