Page MenuHomeSoftware Heritage
Paste P1505

(An Untitled Masterwork)
ActivePublic

Authored by zack on Oct 24 2022, 4:46 PM.
cat test.json | jq '.files[0] | {(.path): .licenses[] | [.spdx_license_key, .score, (.matched_rule | .is_license_intro, .is_license_notice, .is_license_reference, .is_license_tag, .is_license_text)]}'
{
"blobs/00/18/0018b4debcb94a83e43060fde0f8c88baa8ca476": [
"MIT",
100,
false,
false,
true,
false,
false
]
}
{
"blobs/00/18/0018b4debcb94a83e43060fde0f8c88baa8ca476": [
"MIT",
100,
false,
false,
false,
false,
true
]
}
# Desired output (more or less):
["blobs/00/18/0018b4debcb94a83e43060fde0f8c88baa8ca476", "MIT", 100, false, false, true, false, false]
["blobs/00/18/0018b4debcb94a83e43060fde0f8c88baa8ca476", "MIT", 100, false, false, false, false, true]
# Solution
$ cat test.json | jq '.files[0] | (.path | split("/"))[3] as $name | (.licenses[] | [$name, .spdx_license_key, .score, (.matched_rule | .is_license_intro, .is_license_notice, .is_license_reference, .is_license_tag, .is_license_text)])'
["0018b4debcb94a83e43060fde0f8c88baa8ca476", "MIT", 100, false, false, true, false, false]
["0018b4debcb94a83e43060fde0f8c88baa8ca476", "MIT", 100, false, false, false, false, true]

Event Timeline

zack edited the content of this paste. (Show Details)