Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
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
Roku Guru

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")
0 Kudos