I'm learning Python and aws.
What I want is to extract value from the JSON response. This code works for JSON response that doesn't contain date values, but in this case response contains date value.
Here is my code:
import datetime
from datetime import date, datetime
import boto3
import json
client = boto3.client('lex-models')
response = client.get_utterances_view(
botName='CreateServicesBot',
botVersions=[
'$LATEST',
],
statusType='Missed'
)
with open('/tmp/output.json', 'w') as data:
json.dump(response,data)
with open('/tmp/output.json') as f:
data = json.load(f)
ustr=data["utteranceString"]
print ustr
I'm getting this error:
TypeError: datetime.datetime(2018, 6, 7, 9, 44, 38, 146000, tzinfo=tzlocal()) is not JSON serializable
Does someone know the solution? thx