I am trying to save conversation detail API response into a json file, but it gives me an error. All I want is to save 'api_response ' in a json file using python.
api_response = api_instance.post_analytics_conversations_details_query(body)
with open(f'{api_responses_path}_{pageNumber}.json', mode='w') as localfile:
json.dump(api_response, localfile)
TypeError: Object of type AnalyticsConversationQueryResponse is not JSON serializable
If I try to convert to json data,
data = api_response.json()
I get this error - 'AnalyticsConversationQueryResponse' object has no attribute 'json’, Is there a better way ?
It's currently on the backlog of open issues. If you know how it can be fixed within the SDK, you can submit a PR to the Python SDK templates. Until the issue is resolved, you'll need to write a method in your code to output the properties the way you want to work around the issue with using json.dump().