-
I spend 2 day to get the following text replace without any luck, can anyone advise? {
"device_id": "88:AA:CC:5A:F7:90",
"ssid_statuses": {
"5": [
{
"enabled": 0,
"ifname": "ra1",
"ssid": "ssid_guest1" <<< Change to "ssid": "[REDACTED]"
},
{
"enabled": 0,
"ifname": "ra2",
"ssid": "ssid_guest2" <<< Change to "ssid": "[REDACTED]"
},
{
"enabled": 0,
"ifname": "ra3",
"ssid": "ssid_guest3" <<< Change to "ssid": "[REDACTED]"
}
]
},
"uptime":896790
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hi @lzwaan ! This should work for you:
The first It can be useful to use the VRL REPL ( |
Beta Was this translation helpful? Give feedback.
-
It looks like $ .
{ "device_id": "88:AA:CC:5A:F7:90", "ssid_statuses": { "5": [{ "enabled": 0, "ifname": "ra1", "ssid": "ssid_guest1" }, { "enabled": 0, "ifname": "ra2", "ssid": "ssid_guest2" }, { "enabled": 0, "ifname": "ra3", "ssid": "ssid_guest3" }] }, "uptime": 896790 }
$ redact(., filters: [r'^ssid_guest.*'])
{ "device_id": "88:AA:CC:5A:F7:90", "ssid_statuses": { "5": [{ "enabled": 0, "ifname": "ra1", "ssid": "[REDACTED]" }, { "enabled": 0, "ifname": "ra2", "ssid": "[REDACTED]" }, { "enabled": 0, "ifname": "ra3", "ssid": "[REDACTED]" }] }, "uptime": 896790 } |
Beta Was this translation helpful? Give feedback.
-
Thank you both, what a wonderful application it is... |
Beta Was this translation helpful? Give feedback.
Hi @lzwaan !
This should work for you:
The first
map_values
iterates over the elements inssid_statuses
. The secondmap_values
iterates over each element in eachssid_status
.It can be useful to use the VRL REPL (
vector vrl
) to develop VRL programs, if you aren't already familiar with it.