0

If I have a POJO class like

public class Employee {
     public String name;
     public String department;
}

Jackson can convert it to a json string '{"name" : "x", "depaturement" : "y"}'; I want to get the same POJO information. Dose there have a function likes below:

RootNode rootNode = JacksonSomeFunction.get(Employee.class) assert(rootNode[0].name == "name") assert(rootNode[0].type == String.class)

  • Once you have the `JsonNode`, you can check its JSON type (object, array, string, number, boolean, null). If it's an object, you can retrieve its fields. – Sotirios Delimanolis May 08 '16 at 16:36
  • JsonNode is not what I want. the parameter of `objectMapper.valueToTree` is a object. But I My question is get all member of a POJO class, and I can know the type and name of the member. – user3529280 May 08 '16 at 17:21
  • 1
    Oh, then that has nothing to do with Jackson or JSON. You want [Reflection](https://docs.oracle.com/javase/tutorial/reflect/). – Sotirios Delimanolis May 08 '16 at 17:22

0 Answers0