Updated generic API call to trim JSON response