0

I am trying to send a JSON to a REST controller, written in Spring, and no matter what I have tried - the Jackson throw an exception:

org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Illegal character ((CTRL-CHAR, code 10)): 

This is the JSON:

{"fact checking": [ {"fact": "Clinton Foundation has no ships, didn’t smuggle refugees", "status":"false","source":"http://www.politifact.com/punditfact/statements/2017/may/12/blog-posting/fake-news-clinton-foundation-has-no-ships-didnt-sm/", "actual":"One way to tell if the story is made up, beyond its absurdity, is a link allegedly to a CNN story that is actually to a Forrest Gump meme that reads, "Are you stupid or something?""}, {"fact":"AG Jeff Sessions claims district attorneys charge immigrants for lesser crimes", "source":"http://www.politifact.com/truth-o-meter/statements/2017/may/10/jeff-sessions/sessions-claims-district-attorneys-charge-immigran/", "status":"half true", "actual":"Sessions spoke about "criminal aliens," a term generally applied to non-U.S. citizens – living in the United States legally or illegally – who are convicted of crimes."}, {"fact":"Is Sean Spicer Wearing Mismatched Shoes?", "source":"http://www.snopes.com/sean-spicer-shoes/", "status":"true", "actual":"A photograph showing the White House press secretary wearing two different types of footwear is real, but the oddity appears to serve a medical purpose rather than an avant-garde fashion choice."} ]}

Any advice?

yonatan
  • 177
  • 1
  • 2
  • 14
  • Have you seen this? http://stackoverflow.com/questions/31537153/jsonparseexception-illegal-unquoted-character-ctrl-char-code-10 – RubioRic May 14 '17 at 19:08

2 Answers2

1

Your JSON has 2 double quotes within a string value. See screenshot. enter image description here

I believe the JSON when returned from the source is incorrect or the character encoding you are providing is not right.

Yeshodhan Kulkarni
  • 2,844
  • 1
  • 16
  • 19
1

I've pasted your JSON document in a JSON formatter and as you can see it complains about an unexpected token at position 404. That's because you haven't properly escaped the document and the double quotation mark (") at position 404 are confusing the parser. You should escape quotes that appear within keys/value by replacing them with \" (or \' for single quotes).

After escaping the string , the formatter parses the document successfully

yairhoff
  • 102
  • 3