Legacy Dev Forum Posts

 View Only

Sign Up

Do you know how to get the data with correct json format that can be read and convert to csv?

  • 1.  Do you know how to get the data with correct json format that can be read and convert to csv?

    Posted 06-05-2025 18:20

    Wang_Jiajun | 2021-11-24 06:54:17 UTC | #1

    I am using the following codes to extract PureCloud Analytics data via API.

    apiinstance = PureCloudPlatformClientV2.AnalyticsApi() body = PureCloudPlatformClientV2.UserDetailsQuery() # UserDetailsQuery | query body.interval = "2021-01-01T01:01:59/2021-01-02T01:01:59" jsonclass = apiinstance.postanalyticsusersdetailsquery(body) jsonstring = jsonclass._str__()

    And got the result like below json format.

    I've tried to use Python or Databricks dataframe to open and read this data, but failed with the following error. error: corruptrecord: string (nullable = true)

    Do you know how to get the data with correct json format that can be read and convert to csv?


    anon11147534 | 2021-11-24 16:14:59 UTC | #2

    Hi,

    Sorry, my answer to your previous question wouldn't work in that situation. All models implement a to_json method so you could use json_class.to_json() to represent the response as valid JSON.


    Wang_Jiajun | 2021-11-25 00:57:19 UTC | #3

    Thank you so much, it works now.


    system | 2021-12-26 00:58:19 UTC | #4

    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: 12747