# Array to JSONL

`array-to-jsonl` · version 1.0.0 · JSON & JSONL · free, no key needed

Serialize an array of JSON-safe values as JSON Lines text.

**Use when you need to: array to jsonl · serialize array as json lines · convert json array to jsonl.**

## Supported

- array to jsonl
- serialize array as json lines
- convert json array to jsonl

## Not supported

- pretty-print jsonl
- sort object keys
- JSONL comments
- non-integer numbers
- read files

## Behavior

- values is an array of at most 5000 JSON-safe values: object, array, string, boolean, null, or safe integer.
- Each value is serialized with stringifyJsonValue: compact text, object keys in given enumerable own-key order, safe integers as JSON numbers.
- Lines are joined with LF and a non-empty document always ends with a trailing LF.
- An empty values array yields empty text with no newline.
- Serialized UTF-8 text must not exceed 250 KiB.
- Prototype-like own keys are ordinary keys and are emitted in given order.

## Input

- `values` (array of any, required): max items 5000

## Output

- `text` (string, required): max length 256000

## Limits

- max items: 5000
- max output bytes: 256000

## Example

Request input:

```json
{
  "values": [
    {
      "name": "Ada",
      "ok": true
    },
    "שלום",
    0,
    null
  ]
}
```

Response:

```json
{
  "result": {
    "text": "{\"name\":\"Ada\",\"ok\":true}\n\"שלום\"\n0\nnull\n"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "array-to-jsonl",
  "version": "1.0.0",
  "input": {
    "values": [
      {
        "name": "Ada",
        "ok": true
      },
      "שלום",
      0,
      null
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/array-to-jsonl/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"values":[{"name":"Ada","ok":true},"שלום",0,null]}'
```

The machine-readable contract is at [/v1/tools/array-to-jsonl/versions/1.0.0](/v1/tools/array-to-jsonl/versions/1.0.0).

### CLI

```sh
node cli.mjs run array-to-jsonl 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [JSONL to array](/tools/jsonl-to-array): Parse strict JSON Lines text into an array of JSON-safe values.
- [JSON to CSV](/tools/json-to-csv): Serialize string-valued JSON rows to CSV using explicit ordered columns.
- [JSON array index by](/tools/json-array-index-by): Convert an array of objects into a single object indexed by a specific key.
- [JSONL validate](/tools/jsonl-validate): Validate strict JSON Lines text and report the value count and UTF-8 byte length.
- [JSON array anti join](/tools/json-array-anti-join): Anti join two JSON arrays of objects on exact keys.
- [JSON array concat](/tools/json-array-concat): Concatenate multiple JSON arrays of objects into one.
