isJson() function, with tests