'DAO class for Json object

I have Json format like this :-

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

I want to create DAO class of it. As I am new in Spring unable to figure out proper way of it. Can anyone suggest proper way ? Thanks !



Solution 1:[1]

You can use something like following. Make sure you change the names to Java Naming Standards

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abdullah Khan