I have the following PHP string:
“{‘blah’:1178,’blah’:0,’blah’:260,’blah’:0,’needWrapper’:
{‘NEED’:’TEXTNEED’,’NEED’:’TEXTNEED’}, ‘blah’:’blah’}”
EDIT: I broke it up to hopefully make it more readable
I need to get the “NEED: TEXTNEED” and “NEED: TEXTNEED” substrings from that. I feel like there’s a good way to do that with regex’s or using explode or something but I can’t quite piece together an elegant/working solution. Any help would be appreciated.
If you replace the single quotes with double quotes, it can be parsed with json:
Now you can just access the objects.
If the source is coming from php, it should be able to produce valid JSON with double quoted objects:
http://www.php.net/manual/en/function.json-encode.php