Skip to Content

JSON Extract

Extract nested JSON properteis into new output fields.

Billable OperationProviderBilling Mode
Docs
Connection
Docs
Cost per operation
Docs
pipe0-extract-json
P
pipe0
Always
Managed

0.00 credits

const options = {
  method: 'POST',
  headers: {'content-type': 'application/json', authorization: 'Bearer <TOKEN>'},
  body: JSON.stringify({
    config: {environment: 'production'},
    pipes: [
      {
        pipe_id: 'json:extract@1',
        config: {
          json_extraction: {
            field_name: 'example_json',
            extractions: [
              {
                path: 'name',
                output_field: {
                  format: null,
                  name: 'extracted_name',
                  label: 'Simple Example Using Jsonata Path',
                  type: 'string'
                }
              },
              {
                path: '{ "fullName": name, "count": $count(nested) }',
                output_field: {
                  format: null,
                  name: 'reshaped_object',
                  label: 'Complex Transformation Using Jasonata',
                  type: 'json'
                }
              }
            ]
          }
        }
      }
    ],
    input: [{id: '1', example_json: {name: 'John Doe', nested: [1, 2, 3]}}]
  })
};

fetch('https://api.pipe0.com/v1/pipes/run', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));