Legacy Dev Forum Posts

 View Only

Sign Up

How do you save API response in a json file?

  • 1.  How do you save API response in a json file?

    Posted 06-05-2025 18:08

    kayb | 2019-01-03 23:45:19 UTC | #1

    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 'apiresponse ' in a json file using python. apiresponse = apiinstance.postanalyticsconversationsdetailsquery(body) with open(f'{apiresponsespath}{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 ?

    Can someone help here, Thanks for reading!


    tim.smith | 2019-01-04 14:21:59 UTC | #2

    I've added this issue report to API-2635.


    kayb | 2019-01-07 16:54:49 UTC | #3

    @tim.smith how can I get help on this issue? I mean is there a group called 'API-2635', or it's a deprecated API issue. Thanks


    tim.smith | 2019-01-07 17:43:35 UTC | #4

    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().


    kayb | 2019-01-07 18:07:54 UTC | #5

    Thanks @tim.smith for your reply.


    system | 2019-02-18 09:10:17 UTC | #7

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 4278