returning JSON data
catching errors