Adds dataType = 'json' if url contains .json

little improvement on top of Stefano fix.