kelseyhightower / confd

Manage local application configuration files using templates and data from etcd or consul
MIT License
8.33k stars 1.41k forks source link

Can we have complex jsonArrays, like (Arr(Arr)) #848

Open mudit-97 opened 3 years ago

mudit-97 commented 3 years ago

I had a requirement to parse this kind of structure: { "animals": [ { "type": "dog", "name": "Fido", "abc": [ "a", "b" ] }, { "type": "cat", "name": "Misse", "abc": [ "a", "b" ] } ] }

I am trying to write a jsonArray inside a jsonArray but ending in errors like:

at <.abc>: wrong type for value; expected string; got []interface {}

My template looks like this: {{range jsonArray (getv "/animals")}} name: {{.name}} type: {{.type}} {{$abc := jsonArray .abc}} {{end}}