Use json when cors is supported