简体   繁体   English

DAO class 为 Json object

[英]DAO class for Json object

I have Json format like this:-我有这样的 Json 格式:-

{
    "[0].Storage": {
        "telemetryPrefix": ["System_Storage_*", "Storage_*"],
        "uiOrder": 1
    },
    "[1].Network": {
        "telemetryPrefix": ["System_Network_*", "Network_*"],
        "uiOrder": 2
    },
}

I want to create DAO class of it.我想创建它的 DAO class。 As I am new in Spring unable to figure out proper way of it.因为我是 Spring 的新手,无法找出正确的方法。 Can anyone suggest proper way?谁能建议正确的方法? Thanks !谢谢 !

You can use something like following.您可以使用如下内容。 Make sure you change the names to Java Naming Standards确保将名称更改为 Java 命名标准

public class 0Storage{
    public ArrayList<String> telemetryPrefix;
    public int uiOrder;
}

public class 1Network{
    public ArrayList<String> telemetryPrefix;
    public int uiOrder;
}

public class Root{
    @JsonProperty("[0].Storage") 
    public 0Storage _0Storage;
    @JsonProperty("[1].Network") 
    public 1Network _1Network;
}

There are online tools(like this ) you can use for more complex data structures.您可以使用在线工具(如this )来处理更复杂的数据结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM