It's hard to say for sure without seeing the stack trace that comes with the JSONException, but my first guess would be that you forgot to annotate your ServerMessage DTO with @Portable.
My second guess is that your REST client is getting an HTML error page of some sort instead of the JSON data it was expecting (possibly an Internal Server Error page, or a Not Found page with a status code of 200 rather than 404).
If you could follow up with the following information, we can probably help you pinpoint the exact issue:
- The full Dev Mode stack trace associated with the JSONException
- A dump of the HTTP request that the REST client made, and the response from the server. You can obtain this from the developer tooling in your browser (in Chrome, View -> Developer -> Developer Tools, then click on the Network tab)
- All log messages generated on the server side while it was processing the REST request