When I called a REST service (provided by webMethods Integration Server) with curl
on my Windows machine, I got the following error:
org.codehaus.jackson.JsonParseException:Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: com.wm.net.HttpInputStream@74356f93; line: 1, column: 2]
The solution was quite simple: use double quotes instead of single quotes when providing JSON payload.
The curl
call that led to the above message looked like this:
curl^
-X POST^
-H "Accept: application/json"^
-H "Content-Type: application/json"^
-d '{"Username":"Stefan","Password":"secret"}'^
http://server/service
After changing the fifth line to -d "{\"Username\":\"Stefan\",\"Password\":\"secret\"}"^
everyhing worked as expected.
+1