Updated the detection method to support JSON.