0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

Operator → Extract JSON Values

AI-generated

Overview

The "Extract JSON Values" operation under the "Operator" resource in this node allows users to extract specific values from a given JSON object by specifying an array of keys. This is useful when you have a complex JSON structure but only need certain fields for further processing or decision-making within your workflow.

Practical examples include:

  • Extracting user details like name and age from a larger profile JSON.
  • Picking out configuration parameters from a settings JSON object.
  • Filtering relevant data fields before sending them to another service or node.

Properties

Name Meaning
JSON Data The JSON object from which values will be extracted. Example: {"name": "John", "age": 30}
Keys to Extract An array of keys whose corresponding values should be extracted from the JSON object. Example: ["name", "age"]

Output

The output contains a JSON object with key-value pairs where keys are those specified in the "Keys to Extract" property, and values are the corresponding values from the input JSON object.

For example, if the input JSON is:

{
  "name": "John",
  "age": 30,
  "city": "New York"
}

and the keys to extract are:

["name", "age"]

the output JSON will be:

{
  "name": "John",
  "age": 30
}

This node does not output binary data.

Dependencies

  • Requires an API key credential for authentication to the external service at https://prod.0codekit.com.
  • The node sends a POST request to the endpoint /operator/advancedswitch with the JSON object and keys as the request body.

Troubleshooting

  • Empty or missing keys: If the keys array is empty or contains keys not present in the JSON object, the output may be empty or missing those keys. Ensure the keys exist in the input JSON.
  • Invalid JSON input: Providing malformed JSON in the "JSON Data" property will cause errors. Validate JSON format before running.
  • Authentication errors: Missing or invalid API key credentials will prevent the node from executing successfully.
  • Network issues: Connectivity problems to the external API endpoint can cause timeouts or failures.

Links and References

Discussion