Get a JSON's Item
Extracts a specific element or elements from a JSON structure.
Overview
This procedure extracts a specific element or elements from a JSON structure based on the specified "thing" (field name or path). The thing can be specified with additional adjectives to refine the search within the JSON structure. It supports both simple field access and nested path traversal using dot notation (e.g., address.city) or possessive syntax (e.g., address's city). When the JSON is an array, it can extract values from multiple objects.
Input
json
json
The JSON structure from which the thing is to be extracted
Yes
N/A
thing
string
The specific element or elements to extract from the JSON (can include adjectives to refine the search)
Yes
N/A
Output
result
The extracted element or elements from the JSON structure. If multiple elements are extracted, they are returned as a list
Examples
1. Getting a simple field from a JSON object
This example extracts the "name" field from a JSON object.
get the json
get the json's name2. Getting a field with an adjective
This example extracts the "first name" field from a JSON object. If the JSON is an array, it returns the "name" field from the first element.
get the json
get the json's first name3. Getting nested fields using dot notation
This example extracts the "city" field from the nested "address" object using dot notation.
get the json
get the json's address.city4. Getting nested fields using possessive syntax
This example extracts the "city" field from the nested "address" object using possessive syntax.
get the json
get the json's address's city5. Getting fields with spaces
This example extracts a field named "address city" (a single key with a space in it).
get the json
get the json's address city6. Getting fields from a JSON array
This example shows how to extract fields from an array of JSON objects. When the JSON is an array like [{"Product Name": "P854282R COMP", "Price": "$53.00"}, {"Product Name": "F854734 COMP", "Price": "$34.95"}], you can use ordinals like "first" and "second" to access specific elements.
get the term as a json
get the json's Prices
get the json's first Price
get the json's first Product Name
get the json's second Quantity7. Getting deeply nested fields
This example demonstrates accessing deeply nested fields using multiple possessive syntax. For a JSON structure with customers, orders, and order details, this navigates through multiple levels to extract the id field.
get the foo's first order's first detail's id8. Handling fields with camelCase or special naming
This example shows accessing fields with camelCase naming conventions like "threadId", "historyId", and "sizeEstimate".
get the email's threadId
get the email's historyId
get the email's sizeEstimateLast updated
Was this helpful?
