I have a JSON string and one of the fields is a text field. This text field can contain text that a user enters in the UI and if the text they enter is JSON text, perhaps to
I'm doing something similar, just with XML instead of JSON: On receiving malformed or otherwise non-processable data the server returns an error-structure containing some information and the original data. To prevent the client from parsing the corrupt data again it's base64 encoded on the server.
So instead of sending
{
title : "My sample code",
payload : "{ \"foo\" : \"bar\" }"
}
consider sending
{
title : "My encoded sample code",
payload : "eyAiZm9vIiA6ICJiYXIiIH0="
}