0

I am calling http post method from java class. Example, suppose there is a task creator portal where there are few columns task id, description, assignee field, components, task summary. I am calling http client.execute(post). and passing the body as task id, description, assignee field, components, task summary. If description contains new line it's not able to post and the Json objects also i am not able to get properly. Getting below error code:

Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n

I shall be highly obliged if somebody can help. Let me know if you need more details regarding the situation.

Thank you.

  • 1
    Possible duplicate of [JsonparseException Illegal unquoted character ((CTRL-CHAR, code 10)](https://stackoverflow.com/questions/31537153/jsonparseexception-illegal-unquoted-character-ctrl-char-code-10) – rghome Sep 04 '17 at 12:44
  • So... did you quote the newline? Issue seems fairly clear. – Dave Newton Sep 04 '17 at 12:44
  • Can you post your code which serializes the data into Json before posting it over http? – Sunil Singhal Sep 04 '17 at 12:46
  • @DaveNewton see in the HTTP body if I replace the new line with space it's working. str.getDescription().replaceAll("\n", " ") . it's basically putting in one line and posting it. my doubt is how can I post the new line also. – Sourav Saha Sep 04 '17 at 13:55
  • Escape it, like the error indicates isn't happening? – Dave Newton Sep 04 '17 at 15:57

0 Answers0