Hello Folks ,
I have json data in below format. I am looking for a best solution to table list of Keys which can be eventually used for input dropdown in dashboard.
output of the table content needs to be like below. your help is much appreciated.
bzk.f1
bzk.f4
bzk.f8
{ [-]
bzk: { [-]
f1: ABC
f4: ABC
f8: ABC
}
}
So, your data already contain fields named bzk.f1, bzk.f4, etc. The following should give you a single-field table:
| foreach bzk.*
[eval inputfield = mvappend(inputfield, "<<FIELD>>")]
| table inputfield
Alternatively, you can use spath together with the newer JSON functions
| spath input=data path=bzk
| eval inputfield = json_array_to_mv(json_keys(bzk))
| eval inputfield = mvmap(inputfield, "bzk." . inputfield)
| table inputfield
| spath
| fields - _time _raw
| transpose column_name=name
| fields name