Skip to content Skip to sidebar Skip to footer

Json: Concatenate 2 String Values In Value

Hi I have a JSON like: { 'name' : 'avg', 'code' : {'value':' import android droid = android.Android() droid.makeToast('Hello, Android!')',

Solution 1:

Its better to configure your server to send you HTML-encoded value string. Afterwards, it would be easier to re-construct and show in TextView, for e.g.

Your expected Json response:

{"name":"avg","code":{"value":"import android<br />droid = android.Android()<br />droid.makeToast('Hello, Android!')","type":"PythonScript"}}

Once you read the value string:

String html_encoded_string = "import android<br />droid = android.Android()
<br />droid.makeToast('Hello, Android!')";

Then its easier to put it in TextView using html encoding:

yourTextView.setText(Html.fromHtml(html_encoded_string));

Post a Comment for "Json: Concatenate 2 String Values In Value"