Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final ObjectMapper mapper = new ObjectMapper();
- public static void main(String[] args) throws Exception {
- JsonNode rootArray = mapper.readTree(new File("test.json"));
- for (JsonNode root : rootArray) {
- long id = root.path("id").asLong();
- System.out.println(id);
- JsonNode projectNode = root.path("projects");
- if (projectNode.isArray()) {
- for (JsonNode node : projectNode) {
- String name = node.path("name").asText();
- JsonNode issueNode = node.path("issues");
- if (issueNode.isArray()) {
- for (JsonNode nodeIssue : issueNode) {
- String title = nodeIssue.path("title").asText();
- System.out.println(title);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment