Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how I search an object value from given json #120

Open
sanswarn opened this issue Aug 31, 2023 · 0 comments
Open

how I search an object value from given json #120

sanswarn opened this issue Aug 31, 2023 · 0 comments

Comments

@sanswarn
Copy link

sanswarn commented Aug 31, 2023

Hi,

The example below shows how to get "display_name" from a large file by using the multi-search function. I want to search for display_name everywhere it is declared and print the results flat.

I'm aware of one method, but it doesn't work when there are numerous large files.
jq .resources[0].instances[].attributes.display_name

I want something like jq.resources[?display_name == *]

[
{
"mode": "managed",
"type": "oci_waf_web_app_firewall",
"name": "test_web_app_firewall",
"provider": "provider.oci",
"instances": [
{
"schema_version": 0,
"attributes": {
"backend_type": "LOAD_BALANCER",
"compartment_id": "ocid1.compartment.oc1..aaaxukeba",
"defined_tags": {},
"display_name": "FINAL_SAN_TEST1_LB",
"freeform_tags": {},
"id": "ocid1.webappfirewall.oc1.pyt4hj7jznoaqa",
"lifecycle_details": null,
"load_balancer_id": "ocid1.loadbalancer.oc1.phx.aaaaacrxg42huyucq",
"state": "ACTIVE",
"system_tags": {
"orcl-cloud.free-tier-retained": "false"
},
"time_created": "2 +0000 UTC",
"time_updated": "245:39.074 +0000 UTC",
"timeouts": null,
"web_app_firewall_policy_id": "ocid1.webappfirewallpolicy.oc1.phx.amaaaaaawshrd3ia2ygpfij3qni5x6jxyvsvzwvdlnju7y5yecio3avxrwfa"
},
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGYJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19",
"dependencies": [
"oci_waf_web_app_firewall_policy."
]
}
]
}

@sanswarn sanswarn changed the title how I search a an object value from given json how I search an object value from given json Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant