Today the project used Jackson, the manager said that more efficient, so began to use, the beginning of the JSON to the object, the object to JSON is still very simple, but there are still some problems, and then add a bit of configuration properties there is no error
1 New Objectmapper (); 2 Entity result = Mapper.readvalue (data, entity. Class); 3 Entity result = Mapper.readvalue (data, entity. Class);
If the object goes to JSON, the corresponding method is
New Objectmapper (); = mapper.writevalueasstring (student1);
But if the JSON into a list or array will become not so simple, from the Internet to find a lot of examples to try can not, later I brainwave, think of a way, that is to create the entity, and then directly to the object, found that really works, so it is here to record, for forgetting, The JSON string is as follows:
{" data": { "totalsize": 0, "results": [], "Empty": true }, "Error_message": "", "error _code ": 0, " status ":" Success "}
The code for the turn is shown below
New Objectmapper (); = Mapper.readvalue (data, Repaymentresult. Class);
Found with the above-mentioned code, but this will create more than a few entity classes, but there is no turning the trouble, but one thing to remember, that is, the property value of the image and JSON inside the key value of the same can be Oh!
Jackson JSON goto List