Corrected implementation for json detection

The detection should be done using a try/catch :S