How do I access the ordered list of customers
in the following .conf in Play 2.6.x (Scala):
customers {
"cust1" {
env1 {
att1: "str1"
att2: "str2"
}
env2 {
att1: "str3"
att2: "str5"
}
env3 {
att1: "str2"
att2: "str6"
}
env4 {
att1: "str1"
att2: "str2"
}
}
"cust2" {
env1 {
att1: "faldfjalfj"
att2: "reqwrewrqrq"
}
env2 {
att1: "falalfj"
att2: "reqwrrq"
}
}
"cust3" {
env3 {
att1: "xvcbzxbv"
att2: "hello"
}
}
}
List("cust1", "cust2", "cust3")
, in this example.
The following example should work:
Edit
If customers are in lexicographical order than you can order call
.sorted
If changing your config doesn't affect your already implemented logic than you can restructure your config like this:
and with pureconfig you can do the following:
Will give you.
You obviously have to then transform this if you want to work with objects.