# stringify

Serializes a structured value into a format string. This is the inverse of `parse`.

#### Syntax

```
stringify(format, value)
```

or chained:

```
<value>.stringify(format)
```

#### Arguments

* **format** (`string`) - The output format (`"json"`, `"yaml"`, `"toml"`, etc).
* **value** (optional when chained) - The structured value to serialize.

#### Notes

`stringify` always produces compact output (no indentation or extra whitespace). This is the expected behavior when embedding a serialized value in a query.

#### Examples

**Serialize to JSON**

```
stringify("json", {"a": 1, "b": 2})
```

Output:

```json
{"a":1,"b":2}
```

**Chained usage**

```
{"name": "Tom"}.stringify("yaml")
```

**CLI usage — convert a sub-object to a JSON string**

```bash
$ echo '{"config": {"host": "localhost", "port": 8080}}' \
  | dasel -i json 'config.stringify("json")'
```

**Roundtrip with parse**

```
parse("json", stringify("json", {"a": 1})).a
// 1
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://daseldocs.tomwright.me/functions/stringify.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
