Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.
This repository was archived by the owner on Jun 11, 2019. It is now read-only.

Parsing the JSON response from "updateVideo" must be changed from "getString('result')" to "getJSONObject('result')" in order to comply with JSON spec #8

Description

@rfelgent

A valid response from BrightCove after executing "updateVideo" as an example:

{
    "result": {
        "id": ANY_NUMBER,
        "name": "video name",
        "adKeys": null,
        "shortDescription": "video description",
        "longDescription": "video long description",
        "creationDate": "1450813675021",
        "publishedDate": "1450813675021",
        "lastModifiedDate": "1450813675056",
        "linkURL": null,
        "linkText": null,
        "tags": [
            "tag1",
            "tag2"
        ],
        "videoStillURL": null,
        "thumbnailURL": null,
        "referenceId": null,
        "length": 0,
        "economics": "AD_SUPPORTED",
        "playsTotal": null,
        "playsTrailingWeek": null
    },
    "error": null,
    "id": null
}

the code part in the class WriteApi should be changed from

            Video result = null;
            if(response.getString("result") != null) {
                String jsonResult = response.getString("result");
                result = new Video(jsonResult);
            }

to

            Video result = null;
            if (response.has("result")
                    && response.getJSONObject("result") != null) {
                JSONObject jsonResult = response.getJSONObject("result");
                result = new Video(jsonResult);
            }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions