json

package
v0.10.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 11 Imported by: 0

README

---
title: "JSON"
lang: "en-US"
draft: false
description: "Learn about how to set up a VDP JSON operator https://github.com/instill-ai/vdp"
---

The JSON component is an operator that allows users to manipulate and convert JSON objects.
It can carry out the following tasks:

- [Marshal](#marshal)
- [Unmarshal](#unmarshal)
- [jq](#jq)

## Release Stage

`Alpha`

## Configuration

The component configuration is defined and maintained [here](https://github.com/instill-ai/operator/blob/main/pkg/json/v0/config/definitions.json).

## Supported Tasks

### Marshal

Convert JSON to a string

| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_MARSHAL` |
| JSON (required) | `json` | any | JSON input to be marshaled |

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| JSON string | `string` | string | String representation of the JSON input |

### Unmarshal

Convert a string to JSON

| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_UNMARSHAL` |
| String (required) | `string` | string | JSON string to be unmarshaled |

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| JSON | `json` | any | JSON object extracted from the string input |

### jq

Process JSON through a `jq` command

| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_JQ` |
| JSON input (required) | `jsonInput` | string | JSON string to be processed |
| Filter (required) | `jqFilter` | string | Filter, in `jq` syntax, that will be applied to the JSON input |

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Results | `results` | array | The `jq` command results. Depending on the filter and the input JSON the type of each element may vary. |

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(logger *zap.Logger) base.IOperator

Init returns an implementation of IOperator that processes JSON objects.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL