android - How to use paragraph in json? -


i new in android , having queries in json:-

how can break line in json if having multiple lines? this:
{"contacts":
[
{ "id": "c200",
"name": "ravi tamada",
"email": "xxxx@gmail.com",
"address": "xx-xx-xxxx,x - street, x - country",
"gender": "male",
"about": "sentence1.sentence2.sentence3",
"phone": { "mobile": "+91 0000000000",
"home": "00 000000",
"office": "00 000000" }
}
]
}

if desire line break, use code string using in application. json "data-only" transfer, should not have formatting.

if data formatted, directly should used:

example:

{"myvarname":"sentence1\nsentence2\nsentence3"} 

then on lets javascript (using ajax simplicity)

$.ajax({         datatype: "json",         url: url,         success: function(output){             alert(output["myvarname"]);         }     }); 

edit:

if run example, see correct result.

the following provide correct results: "about": "sentence1.\nsentence2.\nsentence3", if using system, need writte correct line break. meaning in html linebreak </br>, in javascript \nu.s.f. check line break needed append in position desired.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -