Files
nethys-data/extract-json-from-har.nu
2026-05-08 21:49:46 +02:00

16 lines
354 B
Nu
Executable File

#!/bin/env nu
def main [
har_file: path,
--type: string
] {
let jsons = (open --raw $har_file | from json | get log.entries.response | where headers.value has "application/json" | get content.text)
cd (mktemp -d)
mut i = 1;
for json in $jsons {
$i += 1;
$json | save $"($i).json"
}
open *.json | where type? == $type | to json
}