php - How to trim a new line character from JSON encoded string? -
i developing android application communicates php server via json.
in application, encoding key json send server. after encoding,when debug key in logcat, showing new line character @ end of value:
the logcat showing me that:
{"accesskey":"123456789\n"}
because of this,php server won't accept json values.
is there method or suggestions remove new line character? have googled this, can't find satisfactory solution.
if fix on server php should trim response values using trim
now in java method on string object. string.trim();
this should strip out \n or other trailing whitespace
Comments
Post a Comment