Skip to content
This repository has been 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

Open
rfelgent opened this issue Dec 22, 2015 · 1 comment

Comments

@rfelgent
Copy link

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);
            }
@rfelgent rfelgent changed the title Parsing the JSON response from "updateVideo" must be changed from "getString('result')" to "getJSONObject('result')" in order to comply JSON spec Parsing the JSON response from "updateVideo" must be changed from "getString('result')" to "getJSONObject('result')" in order to comply with JSON spec Dec 22, 2015
@rfelgent
Copy link
Author

Is this project dead?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant