I am tried to get this data using template toolkit but I am unable to get.
$var1={
'Object'=>[
{
'Component'=>[
{
'type'=>'analog',
'name'=>'Temp',
'value'=>'23'
},
{
'type'=>'digital',
'name'=>'Temp',
'value'=>'22'
},
{
'type'=>'analog',
'name'=>'pressure',
'value'=>'23'
},
{
'type'=>'analog',
'name'=>'humidity',
'value'=>'23'
}
]
}
],
};
I tried like this
[% FOREACH st IN Object %]
[% FOREACH st IN Object.Component %]
[% Component.type %][% Component.name %][% Component.value %]
[% END %]
[% END %]
I am not able to get the values and aslo it doesn't give any error ,please help how to get this values.
Change your template to:
[% FOREACH obj IN Object %]
[% FOREACH comp IN obj.Component %]
[% comp.type %] [% comp.name %] [% comp.value %]
[% END %]
[% END %]