I receive value from API response like below
{
"first_name" = "active EQ 'true'";
}
I need to send that value as a query parameter in another API. But when sending the request I see that URL is not being encoded. I am expecting that active EQ 'true' should be URL encoded as active%20EQ%20%27true%27.
I tried addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) and it resulted in "active%20EQ%20\'true\'. I see backslash is being added as escape character but not encoding as expected.
let k = "active EQ 'true'"
let j = k.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
print("j is \(j)")
I expected the output as active%20EQ%20%27true%27, but the actual output is active%20EQ%20\'true\'