Transform a JSON string into a one dimensional array

The mission was to transform a JSON string into a one dimensional array. The array keys should contain the path to each JSON node.

The JSON

The result

The result should be an array with the path of every JSON node and its value.

The PHP