Spring Store Nested Json To DB

Viewed 38

I have following json :

{
  "name" : "John",
  "message" : {
    "slack" : "channel",
    "email" : "mymail" ,
    "msteam" : "myteam",
    "kafka" " {"broker" : "url", "topic": "sds"}
     // this list flexiable can have many attribute can have nested json also

 }
}

My Entity Look like this :

@Entity
@Data
@Getter
@Setter
public class Data
{
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long id;

    @Column(nullable = false, columnDefinition="TEXT")
    private String name;

    private HashMap<String, Object> message;
}

I am able to store the above json, but in my db it's not human readable it's serialised, Is this correct way to store the data when we are not sure about the size ?

0 Answers
Related