[deepamehta-devel] JSON deserialization

Jörg Richter jri at deepamehta.de
Fri Sep 16 18:18:49 CEST 2016


> On 16 Sep 2016, at 17:58, Jörg Richter <jri at deepamehta.de> wrote:
> 
> 		// this constructor is invoked by DM4 Webservice / JAX-RS
> 		public EditablePerson(JSONObject json) throws JSONException {
> 			this.firstName = json.getString("firstName");
> 			this.lastName = json.getString("lastName");
> 		}

Note also that in your JSON-constructor you're not required to handle the JSONException yourself.
You just can declare it. It is handled my DM's JAX-RS providers then (see ObjectProvider in module dm4-webservice).

Cheers,
Jörg

-------------- n�chster Teil --------------
Ein Dateianhang mit Bin�rdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigr��e  : 496 bytes
Beschreibung: Message signed with OpenPGP using GPGMail
URL         : <http://lists.deepamehta.de/pipermail/devel-lists.deepamehta.de/attachments/20160916/9dfca2e1/attachment.sig>


More information about the devel mailing list