Google Speech Api Json Parsing In Python?
I have gotten the response of google json api and saved the file in a json file which looks like this JSON file drive.google.com/open?id=1Esuv9KpikqhwccL-dGm-IFfI5S6V7plV And I wa
Solution 1:
Try this:
data = "your json data" # of type`str`
json_dict = json.loads(data)
for result in json_dict["response"]["results"]:
if"alternatives" in result:
alternatives = result["alternatives"][0]
if"confidence" in alternatives:
print(alternatives["confidence"])
if"transcript" in alternatives:
print(alternatives["transcript"])
If your data is coming from a json file, read it first
withopen('data.json', 'r') as f:
data = f.read()
# refer to above code
Post a Comment for "Google Speech Api Json Parsing In Python?"