# stringifyjson: Stringify a JSON Object

> stringifyjson (Stringify a JSON Object) is a 1001fx API function in the group Data & JSON: POST https://api.1001fx.com/data/stringifyjson, 1 credit per call. It works as a ready-made module in n8n or as a plain HTTP call.

Stringifies a JSON Object, optionally replacing values.

- Group: Data & JSON
- Endpoint: `POST https://api.1001fx.com/data/stringifyjson`
- Authentication: header `X-API-KEY: YOURSECRETAPIKEY`
- Content type: application/json
- Credits: 1 credit per call
- Ready-made in: n8n
- Docs: https://1001fx.com/functions/stringifyjson

## Parameters

- `json` (object, required) – JSON Input: The value to convert to a JSON string
- `space` (number, optional, min 0, max 10) – Spacing: A number that's used to insert white space into the output JSON string for readability purposes
- `replacer` (array<string>, optional) – Replacer: An array of strings and numbers that specifies properties of value to be included in the output

## Use cases

- Send a JSON object as a string field to an API that expects text
- Store a JSON object in a single spreadsheet cell or database column
- Keep only selected keys of an object before logging it

## Example: Indented, selected keys

```bash
curl -X POST 'https://api.1001fx.com/data/stringifyjson' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"json":{"module":"address","function":"city"},"replacer":["module"],"space":3}'
```

Answer (HTTP 200):

```json
{
  "result": "{\n   \"module\": \"address\"\n}"
}
```

## FAQ

**How do I get readable, indented output?**

Set space to the number of spaces per indentation level. Without space the string is compact.

**Can I include only some keys?**

Yes. List the keys to keep in replacer. All other properties are left out.
