I\'m trying to write a php script that handles data from a webservice that delivers \"json\" as a string. The problem is the string isn\'t really json; it\'s javascript. Spe
Using regexp is a no-go. JSON grammar cannot be correctly parsed using regexp. You will open yourself to a ton of future bugs.
I recommend using some kind of a YAML parser. YAML is backwards-compatible with JSON and allows unquoted literals at the same time.
Symfony YAML component worked great for me.
And remember that there will be a performance penalty in comparison to json_decode
because it's implemented natively.