Convert a selected text area with JSON or Javascript Object/Array to/from PHP Array notation. If the selected text is empty it will take the content of the clipboard an inserts at the current cursor position.
- User selected text or clipboard content
- Convert from JSON to PHP Array
- Convert from Javascript Objects, Array to PHP Array
- Convert from PHP Array to JSON
- Convert the result of function written in PHP or Javascript to JSON / PHP Array
see Changelog
![preview](docs/preview.gif)from JSON:
{ "key": [1, "string", true, null] }
to PHP Array:
["key"=>[1,"string",true]]
supports Javascript Sparse Arrays
from Javascript Object/Array:
variable = {
key: [1, "string", null, , true],
};
to PHP Code:
["key"=>[1,"string",null,null,true]]
Function calls are interpreted, which allows generate output with any javascript function which is part of the text selection:
from Javascript Code:
[...Array(10).keys()];
to PHP Array:
[0,1,2,3,4,5,6,7,8,9]
from PHP Array:
["key"=>[1,"string",null,true]]
to JSON:
{ "key": [1, "string", null, true] }
Function calls are interpreted, which allows generate output with any php function which is part of the text selection:
from PHP Code return value:
range(0,9)
to JSON:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Command JSON from PHP Array
a local php
binary is required.
This extension contributes the following settings:
php-array-from-json.phpexec
: Set to path of yourphp
binary if the extention cannot find it based on the systemsPATH
settings. Error:Invalid PHP Array Code: Error: spawn php ENOENT
This is a list of features which are not planed to implement:
- Formating the converted result - not needed as there are allready builtin tools which can do this and in most cases the minified version is needed.