Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Double quotes in url that returns json

I have the following:

request.SetUrl("https://.../veceditorial?filter={%22technical.deviceType%22:%22Browser%22,%22veceditorial.Categories%22:{%22$in%22:[%22Drama%22]}}&limit=1&....."

Return me invalid url, 
In debugger mode appears the url, when assigning it as I have to get characters like double quotes, also probe with the following:

......filter={"+ Chr(34) + "technical.deviceType"+...

How can i get a valid url?
0 Kudos
1 REPLY 1
belltown
Level 9

Re: Double quotes in url that returns json

I have no idea what your 'filter' parameter is supposed to be, but whatever it is needs to be url-encoded:
filter = "{%22technical.deviceType%22:%22Browser%22,%22veceditorial.Categories%22:{%22$in%22:[%22Drama%22]}}"
request.SetUrl("https://.../veceditorial?filter=" + request.Escape(filter) + "&limit=1")

If your filter thing is a JSON object, then convert it to a string before encoding:
filter = FormatJson(filterJSON)
request.SetUrl("https://.../veceditorial?filter=" + request.Escape(filter) + "&limit=1")

Also, make sure that if you're using an https url then you call SetCertificatesFile:
request.SetCertificatesFile("common:/certs/ca-bundle.crt")
https://github.com/belltown/
0 Kudos