github.com/instill-ai/component@v0.16.0-beta/pkg/operator/json/v0/README.mdx (about)

     1  ---
     2  title: "JSON"
     3  lang: "en-US"
     4  draft: false
     5  description: "Learn about how to set up a VDP JSON operator https://github.com/instill-ai/instill-core"
     6  ---
     7  
     8  The JSON component is an operator that allows users to manipulate and convert JSON objects.
     9  It can carry out the following tasks:
    10  
    11  - [Marshal](#marshal)
    12  - [Unmarshal](#unmarshal)
    13  - [jq](#jq)
    14  
    15  ## Release Stage
    16  
    17  `Alpha`
    18  
    19  ## Configuration
    20  
    21  The component configuration is defined and maintained [here](https://github.com/instill-ai/component/blob/main/pkg/operator/json/v0/config/definition.json).
    22  
    23  ## Supported Tasks
    24  
    25  ### Marshal
    26  
    27  Convert JSON to a string
    28  
    29  | Input | ID | Type | Description |
    30  | :--- | :--- | :--- | :--- |
    31  | Task ID (required) | `task` | string | `TASK_MARSHAL` |
    32  | JSON (required) | `json` | any | JSON input to be marshaled |
    33  
    34  | Output | ID | Type | Description |
    35  | :--- | :--- | :--- | :--- |
    36  | JSON string | `string` | string | String representation of the JSON input |
    37  
    38  ### Unmarshal
    39  
    40  Convert a string to JSON
    41  
    42  | Input | ID | Type | Description |
    43  | :--- | :--- | :--- | :--- |
    44  | Task ID (required) | `task` | string | `TASK_UNMARSHAL` |
    45  | String (required) | `string` | string | JSON string to be unmarshaled |
    46  
    47  | Output | ID | Type | Description |
    48  | :--- | :--- | :--- | :--- |
    49  | JSON | `json` | any | JSON object extracted from the string input |
    50  
    51  ### jq
    52  
    53  Process JSON through a `jq` command
    54  
    55  | Input | ID | Type | Description |
    56  | :--- | :--- | :--- | :--- |
    57  | Task ID (required) | `task` | string | `TASK_JQ` |
    58  | JSON input (required) | `jsonInput` | string | JSON string to be processed |
    59  | Filter (required) | `jqFilter` | string | Filter, in `jq` syntax, that will be applied to the JSON input |
    60  
    61  | Output | ID | Type | Description |
    62  | :--- | :--- | :--- | :--- |
    63  | Results | `results` | array | The `jq` command results. Depending on the filter and the input JSON the type of each element may vary. |