I am working on PHP web service for android app.
Here I am sending json :
{"company":"wipro","user_id":19,"title":"title_update","from_date":"01-02-2014","to_date":"11-02-2014","additional_notes":"worked with 3 reputed firms"}
this is a valid json but requirement is that user can press 'Enter key' in additional_notes parameter which invalidates the json. Is there any solution possible for such problem? If this is impossible to send json with enter key then is that possible with Xml .
As long as I understood your problem, you want to send the additional_notes key with value containing new-line character ('\n').
For example
{"company":"wipro","user_id":19,"title":"title_update","from_date":"01-02-2014","to_date":"11-02-2014","additional_notes":"worked with 3 reputed firms \n currently working with abc"}
the line currently working with abc
was the text on the new-line.
If you are using text-area for additional_notes then it will automatically add '\n' character for new line. Adding new-line character ('\n') will not invalidate the json. What invalidates the json is when you break the value of additional_notes key to the next line in your script code.
You can make an list/array of single text lines. Parse your multi line text before sending into single line strings and on your server you need to put them together again. Your json should then look something like this:
{"multi_line_text":["line one","line two","line three"]}
It is not the best solution but it should work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With