Testing whether a string contains valid JSON by calling json_decode()
I strongly agree with comment by @Iwrestledabearonce.  When dealing with input, there are normally other means to understand content type (content type headers, additional input fields, or other means to express an explicit contract).  Having forked code paths like this probably means you have a bad design and you should make sure the contract with data source is clear around how to convey what type of data is being passed.  That doesn't mean that the data passed still doesn't need to be validated as hex or JSON input, just that you shouldn't have to rely on performing JSON decoding or regex matching to determine your input data type.

This is especially exacerbated by the fact you mention 1 in 1000 request may have JSON.  Do you really want to perform json_decode() step on all 999 other requests?