How to encode JSON embedded within JSON -


i have json string , 1 of fields text field. text field can contain text user enters in ui , if text enter json text, perhaps illustrate coding, need encode text not interpreted json within actual json structure sent server.

when json structure received server , gets decoded, need make sure embedded json gets decoded text, ends looking json in ui.

in effect, how escape embedded json string?

i'm doing similar, xml instead of json: on receiving malformed or otherwise non-processable data server returns error-structure containing information , original data. prevent client parsing corrupt data again it's base64 encoded on server.

so instead of sending

{   title : "my sample code",   payload : "{ \"foo\" : \"bar\" }" } 

consider sending

{   title : "my encoded sample code",   payload : "eyaizm9viia6icjiyxiiih0=" } 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -