GET Response is no valid JSON


1 comment

  • Avatar
    Stephen Doyle

    Hi Thomas,

    The response from the API is indeed in JSON format and includes double-quotes around strings, for example, after making an HTTP request to `<CLOUD NAME>/resources/image/upload?prefix=sample` and the necessary Authorization header, I receive this in the response:

    "resources": [
    "asset_id": "199ca4f9f4a800affc0a359fec6617ea",
    "public_id": "sample",
    "format": "jpg",
    "version": 1595420636,
    "resource_type": "image",
    "type": "upload",
    "created_at": "2018-09-10T11:10:08Z",
    "bytes": 82504,
    "width": 864,
    "height": 575,
    "access_mode": "public",
    "url": "<CLOUD_NAME>/image/upload/v1595420636/sample.jpg",
    "secure_url": "<CLOUD_NAME>/image/upload/v1595420636/sample.jpg"
    // etc

    In your case, it looks like you're taking the response object from our Node SDK, which was already converted back from a JSON string to Javascript objects in `handle_response` of the API client code.

    If you want to use this response object as JSON, you should be able to convert this back to a JSON string yourself, or serialize it another way according to your requirements - may I ask you to try that please?



    Comment actions Permalink

Please sign in to leave a comment.