added function to get a dictionary from a JSON response