I understand that I can validate json as such:
import json
jsondump = json.dumps(jsonstring)
if json.loads(jsondump):
print("Valid")
else:
("no")
I am trying to distinguish between a JSON string and an x-www-form-urlencoded string. I would like to do this without using the content of the string or check if keys are present to identify this.
I know that the MIME type of a file can be used to identify the content type however, I am not using file as input but rather a string from a variable.
My question is: Can I identify if the content type is x-www-form-urlencoded without using the contents of the string or using a content-type header?