值为\ x26的JSON会破坏PHPs json_decode

https://www.googleapis.com/freebase/v1/search?query=madonna#

The JSON result is breaking PHPs json_decode. To be exact, the following string is breaking decoding: "Sticky \x26amp; Sweet Tour".

Browsers however seem to be able to understand it: http://jsfiddle.net/nggX2/ & http://jsfiddle.net/QUVFt/

http://jsonlint.com/ claims it's invalid JSON.

On PHP's side I've tried: http://codepad.viper-7.com/suUbQD and http://codepad.viper-7.com/QjqCH7

Any thoughts on what's going on?

What's going on is that this is invalid JSON. The response from that url is incorrect--JSON doesn't allow the \xXX two-digit hexadecimal binary escape sequences, only \uXXXX unicode code point escape sequences. Here it should just be &, though--no escape sequence needed.

No idea why google/freebase is outputting invalid JSON.

Your JSON should look like the following:

"Sticky \\x26amp; SweetTour"

The slash needs to be escaped, because it is the escape char.