lilinkevin / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

Jackson Json newline issue #261

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using Jackson 2 generate a simple json (which gives back pretty print json 
as return).
2. Example : Ping health response is : "{\n   \"status\" : \"Success\",\n   
\"pong\" : 1\n}" - which is valid JSON but
looks like rest-assured doesn't like it?
3. I get this error : Caused by: groovy.json.JsonException: A JSON payload 
should start with an openning curly brace '{' or an openning square bracket '['.
Instead, '"{
   "status" : "Success",
   "pong" : 1
}"' was found on line: 1, column: 1

when I try to assert : assertEquals("Success", 
from(response).getString("status"));

What version of the product are you using? On what operating system?
Rest Assured version 1.8.1, Jackson 2.2.3 running on Mac.

Please provide any additional information below.
using Spring rest template to make http calls - not sure if it matters.

Original issue reported on code.google.com by arun0...@gmail.com on 2 Nov 2013 at 12:49

GoogleCodeExporter commented 9 years ago
It seems like your JSON string is not valid JSON since it starts with a ". If " 
is removed (and \n) then I think it should work.

Original comment by johan.ha...@gmail.com on 11 Nov 2013 at 7:27