• Overview
    • Enforce Policy as Code
    • Infrastructure as Code
    • Inject Secrets into Terraform
    • Integrate with Existing Workflows
    • Manage Kubernetes
    • Manage Virtual Machine Images
    • Multi-Cloud Deployment
    • Network Infrastructure Automation
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
  • Registry
  • Tutorials
    • About the Docs
    • Intro to Terraform
    • Configuration Language
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
    • Terraform Tools
    • CDK for Terraform
    • Glossary
  • Community
GitHubTerraform Cloud
Download

    Terraform Cloud and Enterprise

  • Overview
  • Plans and Features
  • Getting Started
    • API Docs template
    • Overview
    • Account
    • Agent Pools
    • Agent Tokens
    • Applies
    • Audit Trails
    • Comments
    • Configuration Versions
    • Cost Estimates
    • Feature Sets
    • Invoices
    • IP Ranges
    • Notification Configurations
    • OAuth Clients
    • OAuth Tokens
    • Organizations
    • Organization Memberships
    • Organization Tags
    • Organization Tokens
    • Plan Exports
    • Plans
    • Policies
    • Policy Checks
    • Policy Sets
    • Policy Set Parameters
      • Modules
      • Providers
      • Private Provider Versions and Platforms
      • GPG Keys
    • Runs
      • Run Tasks
      • Stages and Results
      • Custom Integration
    • Run Triggers
    • SSH Keys
    • State Versions
    • State Version Outputs
    • Subscriptions
    • Team Access
    • Team Membership
    • Team Tokens
    • Teams
    • User Tokens
    • Users
    • Variables
    • VCS Events
    • Workspaces
    • Workspace-Specific Variables
    • Workspace Resources
    • Variable Sets
      • Overview
      • Module Sharing
      • Organizations
      • Runs
      • Settings
      • Terraform Versions
      • Users
      • Workspaces
    • Changelog
    • Stability Policy
    • Overview
    • Creating Workspaces
    • Naming
    • Terraform Configurations
      • Overview
      • Managing Variables
      • Overview
      • VCS Connections
      • Access
      • Drift Detection
      • Notifications
      • SSH Keys for Modules
      • Run Triggers
      • Run Tasks
    • Terraform State
    • JSON Filtering
    • Remote Operations
    • Viewing and Managing Runs
    • Run States and Stages
    • Run Modes and Options
    • UI/VCS-driven Runs
    • API-driven Runs
    • CLI-driven Runs
    • The Run Environment
    • Installing Software
    • Users
    • Teams
    • Organizations
    • Permissions
    • Two-factor Authentication
    • API Tokens
      • Overview
      • Microsoft Azure AD
      • Okta
      • SAML
      • Linking a User Account
      • Testing
    • Overview
    • GitHub.com
    • GitHub.com (OAuth)
    • GitHub Enterprise
    • GitLab.com
    • GitLab EE and CE
    • Bitbucket Cloud
    • Bitbucket Server and Data Center
    • Azure DevOps Services
    • Azure DevOps Server
    • Troubleshooting
    • Overview
    • Adding Public Providers and Modules
    • Publishing Private Providers
    • Publishing Private Modules
    • Using Providers and Modules
    • Configuration Designer
  • Migrating to Terraform Cloud
    • Overview
    • Using Sentinel with Terraform 0.12
    • Manage Policies
    • Enforce and Override Policies
    • Mocking Terraform Sentinel Data
    • Working With JSON Result Data
      • Overview
      • tfconfig
      • tfconfig/v2
      • tfplan
      • tfplan/v2
      • tfstate
      • tfstate/v2
      • tfrun
    • Example Policies
    • Overview
    • AWS
    • GCP
    • Azure
      • Overview
      • Service Catalog
      • Admin Guide
      • Developer Reference
      • Example Customizations
      • V1 Setup Instructions
    • Splunk Integration
    • Kubernetes Integration
    • Run Tasks Integration
    • Overview
    • IP Ranges
    • Data Security
    • Security Model
    • Overview
    • Part 1: Overview of Our Recommended Workflow
    • Part 2: Evaluating Your Current Provisioning Practices
    • Part 3: How to Evolve Your Provisioning Practices
    • Part 3.1: From Manual Changes to Semi-Automation
    • Part 3.2: From Semi-Automation to Infrastructure as Code
    • Part 3.3: From Infrastructure as Code to Collaborative Infrastructure as Code
    • Part 3.4: Advanced Workflow Improvements

  • Terraform Cloud Agents

  • Terraform Enterprise Admin

  • Other Docs

  • Intro to Terraform
  • Configuration Language
  • Terraform CLI
  • Terraform Cloud
  • Terraform Enterprise
  • Provider Use
  • Plugin Development
  • Registry Publishing
  • Integration Program
  • Terraform Tools
  • CDK for Terraform
  • Glossary
Type '/' to Search

»About JSON Data Filtering

Certain pages where JSON data is displayed, such as the state viewer and policy check JSON data viewer, allow you to filter the results. This enables you to see just the data you need, and even create entirely new datasets to see data in the way you want to see it!

entering a json filter

NOTE: Filtering the data in the JSON viewer is separate from searching it. To search, press Control-F (or Command-F on MacOS). You can search and apply a filter at the same time.

»Entering a Filter

Filters are entered by putting the filter in the aptly named filter box in the JSON viewer. After entering the filter, pressing Apply or the enter key on your keyboard will apply the filter. The filtered results, if any, are displayed in result box. Clearing the filter will restore the original JSON data.

entering a json filter

»Filter Language

The JSON filter language is a small subset of the jq JSON filtering language. Selectors, literals, indexes, slices, iterators, and pipes are supported, as are also array and object construction. At this time, parentheses, and more complex operations such as mathematical operators, conditionals, and functions are not supported.

Below is a quick reference of some of the more basic functions to get you started.

»Selectors

Selectors allow you to pick an index out of a JSON object, and are written as .KEY.SUBKEY. So, as an example, given an object of {"foo": {"bar": "baz"}}, and the filter .foo.bar, the result would be displayed as "baz".

A single dot (.) without anything else always denotes the current value, unaltered.

»Indexes

Indexes can be used to fetch array elements, or select non-alphanumeric object fields. They are written as [0] or ["foo-bar"], depending on the purpose.

Given an object of {"foo-bar": ["baz", "qux"]} and the filter of .["foo-bar"][0], the result would be displayed as "baz".

»Slices

Arrays can be sliced to get a subset an array. The syntax is [LOW:HIGH].

Given an array of [0, 1, 2, 3, 4] and the filter of .[1:3], the result would be displayed as [1, 2]. This also illustrates that the result of the slice operation is always of length HIGH-LOW.

Slices can also be applied to strings, in which a substring is returned with the same rules applied, with the first character of the string being index 0.

»Iterators

Iterators can iterate over arrays and objects. The syntax is [].

Iterators iterate over the values of an object only. So given a object of {"foo": 1, "bar": 2}, the filter .[] would yield an iteration of 1, 2.

Note that iteration results are not necessarily always arrays. Iterators are handled in a special fashion when dealing with pipes and object creators (see below).

»Array Construction

Wrapping an expression in brackets ([ ... ]) creates an array with the sub-expressions inside the array. The results are always concatenated.

For example, for an object of {"foo": [1, 2], "bar": [3, 4]}, the construction expressions [.foo[], .bar[]] and [.[][]], are the same, producing the resulting array [1, 2, 3, 4].

»Object Construction

Wrapping an expression in curly braces {KEY: EXPRESSION, ...} creates an object.

Iterators work uniquely with object construction in that an object is constructed for each iteration that the iterator produces.

As a basic example, Consider an array [1, 2, 3]. While the expression {foo: .} will produce {"foo": [1, 2, 3]}, adding an iterator to the expression so that it reads {foo: .[]} will produce 3 individual objects: {"foo": 1}, {"foo": 2}, and {"foo": 3}.

»Pipes

Pipes allow the results of one expression to be fed into another. This can be used to re-write expressions to help reduce complexity.

Iterators work with pipes in a fashion similar to object construction, where the expression on the right-hand side of the pipe is evaluated once for every iteration.

As an example, for the object {"foo": {"a": 1}, "bar": {"a": 2}}, both the expression {z: .[].a} and .[] | {z: .a} produce the same result: {"z": 1} and {"z": 2}.

github logoEdit this page
  • Overview
  • Docs
  • Extend
  • Privacy
  • Security
  • Press Kit
  • Consent Manager