Skip to content

Commit

Permalink
Add embed-in-json transformer docs
Browse files Browse the repository at this point in the history
Adds documentation for the embed-in-json transformer.

Signed-off-by: Daniel Mangum <[email protected]>
  • Loading branch information
hasheddan committed Jul 23, 2024
1 parent 3e82c68 commit 5b0300a
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/data-routing/3-transformers/8-embed-in-json.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: embed-in-json
---

| | |
|---|:---:|
|__Latest Version__| `v1.0.0` |
|__Input Content Type__| Any |
|__Output Content Type__| `application/json` |

The `embed-in-json` transformer embeds data as a UTF-8 JSON string value for the
specifed string key in a new JSON object.

:::info Tip
When dealing with binary data, it may be helpful to use the [`base64`
transformer](/data-routing/transformers/base64) to encode the data as text prior
to embedding. The [`json-patch`
transformer](/data-routing/transformers/json-patch) may be used to modify the
JSON object after embedding.
:::


### Parameters

|Parameter|Type|Description|Required|
|---|---|---|:---:|
|`key`|`string`| The key that input data should be assigned to. ||

### Example Usage

```yaml
transformer:
type: embed-in-json
version: v1
parameters:
key: original
```
### Example Input
```
hello, world!
```

### Example Output

```json
{
"original": "hello, world!"
}
```

0 comments on commit 5b0300a

Please sign in to comment.