DISCLAIMER: This function is weird. It just does something, and you'll have to deal with it. There is no 'expected behavior', the intended use for this is that you want to use some sort of json from somewhere but whoever wrote the api made it invalid. But instead of spending a lot of time making it valid or writing your own function to get your data out of it, you can just use this function. Or, that's the idea. No guarantees ;) To parse JSON.. or whatever looks like it: ?json=your_json_data To view the source: ?source PHP's json_decode function wouldn't have parsed your input. Just saying. My output: Array ( [variable] => value )