Skip to content

Commit

Permalink
Merge pull request #422 from golioth/transformer/embed-in-json
Browse files Browse the repository at this point in the history
Add embed-in-json transformer docs
  • Loading branch information
hasheddan authored Jul 23, 2024
2 parents 3e82c68 + 5b0300a commit 401d126
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 401d126

Please sign in to comment.