Forum Discussion

gabriel_parrale's avatar
9 years ago

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?

1 Reply

  • 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")