Pulkit Singhal - 2012-08-13

The following works fine with json-lib as long as its all on one line:
curl -X POST http://localhost:8080/ -H "Content-Type: application/json" -d '{"prop1":"val1","prop2":"val2"}'

When I spread it out over multiple lines like so:
curl -X POST http://localhost:8080/ -H "Content-Type: application/json" -d '
{
  "prop1":"val1",
  "prop2":"val2"
}'

Then it yields:
net.sf.json.JSONException: Invalid JSON String

I output the payload before running it through the parser on the server and I can see that all of it makes it over to the server just fine so its not a problem from the client/server communication side.

Anyone know how to get around this, is there a flag that can allow this to parse newlines or ignore them from the payload string:
JSON json = JSONSerializer.toJSON(new String(payload));