4 ms·
Really simply, I grab the json from the copy buffer, use `json_decode` then `var_export` and then use some horrible regex stuff to reformat that into a modern s
by noir_lord 5y ago
Really simply, I grab the json from the copy buffer, use `json_decode` then `var_export` and then use some horrible regex stuff to reformat that into a modern short array syntax.
So it looks like `json_to_array.sh --assign --clip` (if no clip just echoes the resulting PHP to stdout)
https://kopy.io/aLpar https://kopy.io/aLpar (its not good code, it's an itch scratcher) - only works on Linux (it's all I use but would be trivial to make it work on a Mac I think).
PHP makes a really good shell scripting language since it's a full blown language with a massive API and can 'talk' to the shell quite simply.