File example.json yang berbentuk json array berikut contoh:
[
{
"CompetitorID": 1,
"Name": "John Doe",
"Score": 85
},
{
"CompetitorID": 2,
"Name": "Jane Smith",
"Score": 92
},
{
"CompetitorID": 3,
"Name": "Alice Johnson",
"Score": 78
},
{
"CompetitorID": 4,
"Name": "Bob Wilson",
"Score": 91
},
{
"CompetitorID": 5,
"Name": "Eve Brown",
"Score": 89
}
]
jq '.[] | select(.Score > 80)' example.json
{
"CompetitorID": 1,
"Name": "John Doe",
"Score": 85
}
{
"CompetitorID": 2,
"Name": "Jane Smith",
"Score": 92
}
{
"CompetitorID": 4,
"Name": "Bob Wilson",
"Score": 91
}
{
"CompetitorID": 5,
"Name": "Eve Brown",
"Score": 89
}
jq '.[] | select(.Score > 80) | {Name, Score}' example.json
{
"Name": "John Doe",
"Score": 85
}
{
"Name": "Jane Smith",
"Score": 92
}
{
"Name": "Bob Wilson",
"Score": 91
}
{
"Name": "Eve Brown",
"Score": 89
}
Comments
Post a Comment