Answer the question
In order to leave comments, you need to log in
How to write json which contain array of objects in pojo?
Hello, the question is actually above.
when I try to pass json and write to pojo I get null
I have two classes and one controller:
@Data
@Component
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class Activity1 {
private String NAME;
private String code;
private String NOTE;
}
@Data
@Getter
@Setter
@Component
public class TestDto {
private Activity1 ACTIVITY;
}
@RestController
@RequiredArgsConstructor
public class BaseController {
@PostMapping("/save")
public ResponseEntity<List<TestDto>> save(@RequestBody List<TestDto> testDtos){
return ResponseEntity.ok().body(testDtos);
}
}
Answer the question
In order to leave comments, you need to log in
Tell me, does the different case of letters in the request and in the response (although there are the same DTOs) give you any thoughts?
And here I am prompted that Jackson serializes and deserializes fields with names from small letters. Either configure Jackson to understand large letters - or send the request with small letters.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question