After reading Freemarker documentation and googling about it I just don't see how can I build my test object (like associated, multilevel array) in freemarker only.
So like:
<#assign seq=["a","b","c"]>
But in more depth - like (pseudo):
a
aa ab ac ad
b
ba bb bc
c
ca cb cc cd ce
Is this possible in freemarker only (as front-end dev waiting for back-end guys to finish it I would really need something like this to work on and not use bare arrays)?
Tnx
That's not just a multi-level array, because each nested array has a name ("a", "b", "c"). The closest I can think of is:
<#assign foo = {
"a": ["aa", "ab", "ac", "ad"],
"b": ["ba", "bb", "bc"],
"c": ["ca", "cb", "cc", "cd", "ce"]
}>
But there you have utilized that FTL hash literals keep their key order. Without that:
<#assign foo = [
{"name" : "a", "value": [ "aa", "ab", "ac", "ad"]},
{"name" : "b", "value": [ "ba", "bb", "bc"]},
{"name" : "c", "value": [ "ca", "cb", "cc", "cd", "ce"]}
]>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With