2022-08-30

Save Nested JSON in MySQL Database using Spring Boot

I want to save this nested JSON data in MYSQL DB which has JSON column using Spring Data JPA.

How can I make Entity class for such data's? I don't want to establish any relationship just want to save the data by taking input and should be able to fetch it.

Do I need to create new entity classes for nested objects even if I don't want to establish any relationship between them?

 {
      "Data": [
        {
          "url": "xyz.com",
          "pswd": "admin",
          "user": "admin",
          "Test_Case": "T01"
        }
      ],
      "Page": [
        {
          "Index": "",
          "Property": "",
          "Identifier": "",
          "Data_Column": "url",
          "Description": "",
          "Screenshots": "",
          "User_Action": "LAUNCH",
          "Identifier_Value": ""
        },
        {
          "Index": "",
          "Property": "",
          "Identifier": "ID",
          "Data_Column": "user",
          "Description": "",
          "Screenshots": "",
          "User_Action": "SET",
          "Identifier_Value": "usernameUserInput"
        },
        {
          "Index": "",
          "Property": "",
          "Identifier": "ID",
          "Data_Column": "pswd",
          "Description": "",
          "Screenshots": "",
          "User_Action": "SET",
          "Identifier_Value": "password"
        },
        {
          "Index": "",
          "Property": "",
          "Identifier": "XPATH",
          "Data_Column": "",
          "Description": "",
          "Screenshots": "",
          "User_Action": "CLICK",
          "Identifier_Value": "//*[@id=\"loginForm\"]/div[10]/div[2]/button"
        },
        {
          "Index": "",
          "Property": "",
          "Identifier": "XPATH",
          "Data_Column": "",
          "Description": "",
          "Screenshots": "",
          "User_Action": "CLICK",
          "Identifier_Value": "/html/body/app-root/app-sidebar/section/div/a[8]/img"
        },
        {
          "Index": "",
          "Property": "",
          "Identifier": "XPATH",
          "Data_Column": "",
          "Description": "",
          "Screenshots": "",
          "User_Action": "HIGHLIGHT",
          "Identifier_Value": "/html/body/app-root/div/app-sc-home/span/ol/li/a"
        }
      ]
    }


No comments:

Post a Comment