How can I unmarhsaller json file like this?
{ "packageId": "11", "jsScript": "var divideFn = function(a,b) { return a/b} ", "functionName": "divideFn", "tests": [ { "testName": "test1", "expectedResult": "2.0", "params": [ 2, 1 ] } ] } I have a class that works well with packageId, jsScrript, functionName, but not with the tests
public class Data { private final int packageId; private final String jsScript; private final String functionName; private final List<Tests> tests; @JsonCreator public Data(@JsonProperty("packageId") String packageId, @JsonProperty("jsScript") String jsScript, @JsonProperty("functionName") String functionName, @JsonProperty("tests") List<Tests> tests) { this.packageId = Integer.parseInt(packageId); this.jsScript= jsScript; this.functionName = functionName; this.tests = tests; } } public class Tests{ public final String testName; public final int expectedResult; @JsonCreator public Tests(@JsonProperty("testName") String testName, @JsonProperty("expectedResult") String expectedResult){ this.testName= testName; this.expectedResult = Integer.parseInt(expectedResult); } } What should I change in classes to make it work well? I also tried to read tests like String, but it didn't help