Skip to content

how I search an object value from given json  #120

Description

@sanswarn

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."
]
}
]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions