1. Convertissez l'objet en une chaîne JSON et renvoyez la valeur en une chaîne JSON
Public Static String TOJSON (Value Object) {try {return mapper.writeValueAsString (valeur);} catch (exception e) {e.printStackTrace ();} return null;} 2. Convertir la chaîne JSON en objet Entity, Retour Valeur en tant qu'objet Entity
public static <t> t toObject (String JSON, class <T> valetype) {assert.hastext (json); assert.notnull (valiseype); try {SimpledateFormat dateFormat = new SimpledateFormat ("yyy-mm-dd hh: mm: ss"); Mapper.setDateFormat (dateformat); MAPPER.READVALUE (JSON, ValuType);} Catch (Exception E) {e.printStackTrace ();} retourne null;