In GET API I have value as,
title=my&title
where the value from query param title returns only my and splits from & character.
Can anyone help me with how can I include & in my value?
In GET API I have value as,
title=my&title
where the value from query param title returns only my and splits from & character.
Can anyone help me with how can I include & in my value?
Your query parameters should be URL-encoded in order to differenciate a separating &
from a random character.
The solution is to encode the value before sending it through the request. You can do so by passing your value to encodeURIComponent()
. You can then parse it the same way and decode it using decodeURIComponent()
, e. g. :
encodeURIComponent('my&title') -> 'my%26title'
decodeURIComponent('my%26title') -> 'my&title'