Box art url is null

Hey, I have this response from new twitch api:

{ “data”: [{ “id”: “493057”, “name”: “PLAYERUNKNOWN’S BATTLEGROUNDS”, “box_art_url”: “’S%20BATTLEGROUNDS-{width}x{height}.jpg” }] }

​Parsing box art url as a string return a null. For me response indicates that it is a string but in docs is written that is an object. If it is indeed an object how it should look as a pojo?

box_art_url is a string, the only reason I can think that the docs say it’s an Object is because it’s a template. It may just be a mistake though.

Just treat it as a string and replace the {width} and {height} with the dimensions you wish to use.

The docs

Match the API output OP has provided

You should JSON parse the response, and the extract resp->data[0]->box_art_url and then substritute/string replace {width} and {height} for number for the dimension of image you need.



can i pass % to the width and height? Or does it have to be in px fixed size?

I’m trying to use it as a background image on a div, what’s the best way if at all possible? Do i have to iterate through the whole array and modify each box_art_url and set the width and height? geez i don’t know who designs twitch’s API :confused:


It lets you pick the size of image you want, rather than have the size dictated by Twitch.

1 Like

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