Let simplify the question:
All I need is to explode() string by a comma between brackets. The problem is that elements selected by comma can have a comma in itself, thus simple exploding won't work. I am not asking how to decode JSON.
The number of arguments, their type will always be different, e.g.
('foo')
('bar', NULL)
({"JSON": "data"}, 'test')
Assuming that I have this part of the code:
({"class": "navigation", "id": "navigation"}, NULL, 'bar' /* [..] */)
Can anyone suggest a regex (or alternative method) to get all the comma separated entries (as string)? The problem is that variables can contain commas in itself. Thus, I assume this requires recursion.
Expected result would be an array containing following entries:
{"class": "navigation", "id": "navigation"}
NULL
'bar'