So I have trying to retrieve JSON which contain many text and late display it on the UI using angularJS. For now I encode the text(using java.net.URLEncode) and am getting the results. The JSON responds with the text being converted (sorry I could not frame the question properly) To make more sense of what the problem is I have a similar question posted here
For example
I have a text "My name is""Mike" which is a parameter to a get request which returns a JSON. Now due to the "" (quote or any other special character) the response is an Invalid JSON.(basically he JSON is cut at that point of text)
To solve this I have encoded the text which atleast returns a valid JSON but with the text converted to "My + name + is + " + " + Mike".
text: java.net.URLEncoder.encode(artifact.text, "UTF-8")
This is something I dont want as on the UI i want the original text (without +). I want to do this on the server side.
Right now I have decoded the text on the UI level by
decodeURIComponent((text+'').replace(/\+/g, '%20'));
but I am assuming the replaced all + in the text but what if + is actually a part of the text eg. "My name is mike+woods". I hope this makes more sense.Json response Single Qoute