Guest User

Untitled

a guest
Jan 23rd, 2023
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import com.fasterxml.jackson.databind.JsonNode;
  2. import com.fasterxml.jackson.databind.ObjectMapper;
  3.  
  4. import java.io.IOException;
  5.  
  6. public class Main {
  7. private static final String INPUT_ALPHA = """
  8. {
  9. "alpha": "beta",
  10. "gamma": false,
  11. "delta": {
  12. "intermediate": ["separator", "separator"],
  13. "nested": {
  14. "key-one": false,
  15. "key-two": "с моей ветки, гандон"
  16. }
  17. }
  18. }
  19. """;
  20. private static final String INPUT_BETA = """
  21. {
  22. "gamma": false,
  23. "delta": {
  24. "nested": {
  25. "key-two": "с моей ветки, гандон",
  26. "key-one": false
  27. },
  28. "intermediate": ["separator", "separator"]
  29. },
  30. "alpha": "beta"
  31. }
  32. """;
  33.  
  34.  
  35. public static void main(String[] args) throws IOException {
  36. ObjectMapper mapper = new ObjectMapper();
  37. JsonNode first = mapper.readTree(INPUT_ALPHA);
  38. JsonNode second = mapper.readTree(INPUT_BETA);
  39. System.out.println("Result: " + (first.equals(second)));
  40. }
  41. }
  42.  
Add Comment
Please, Sign In to add comment