I think most mainstream APIs by now have a way for you to conform the generated answer to a schema.