Convert JS Object to PHP array

Input data

This form allows you convert Javascript literal object to PHP Array, paste or upload your JS object file below:


Your result can be seen below.

Result of JS object conversion to PHP Array


Move to "Paste Code" for Save it

About Javascript object conversion to PHP Array

About JS Object conversion to PHP Array

The Convert Javascript object to PHP array was created for online converting literal JavaScript object into appropriate PHP type as Array. This can be useful for programmers who need to transfer some logic from the javascript programming language to php. You do not need to download any tools for conversion.

How it Works?

Just paste your JS Object to the textarea above and click to the button "Convert" and you will get PHP array in the next textarea.

Example of Javascript object conversion to PHP Array

Before:
{
	animals: {
		dog: [
			{
				name: "Rufus",
				breed: "labrador",
				count: 1,
				twoFeet: false
			},
			{
				name: "Marty",
				breed: "whippet",
				count: 1,
				twoFeet: false
			}
		],
		cat: {
			name: "Matilda"
		}
	}
}
After:
[
  'animals' => [
    'dog' => [
      0 => [
        'name' => 'Rufus',
        'breed' => 'labrador',
        'count' => 1,
        'twoFeet' => false,
      ],
      1 => [
        'name' => 'Marty',
        'breed' => 'whippet',
        'count' => 1,
        'twoFeet' => false,
      ],
    ],
    'cat' => [
      'name' => 'Matilda',
    ],
  ],
]
After the conversion, you can apply the PHP array to your project or use it for some other purpose.
Donate

Did you like this tool? You can donate to us. This will help us improve our free web tools.

Paypal