TokenPad
Datasets

Chat Messages Array Builder

Write a conversation as plain lines, get a valid messages array.

Your input

112 characters3 lines0 tokensor drop a file

Messages BuilderExact
0Token change
Token change0no change
Input tokens0what you pasted
Output tokens0what you would send
Token cost of this result
Output tokens0
As input$0.00
× 100K requests$0.00

Everything on this page runs in your browser. Nothing you paste is transmitted, because there is no server here to transmit it to.

Result
 

The format friction

Conversations are natural to write as lines and awkward to write as JSON. Hand-editing a messages array means escaping every quote and newline, and one missing comma invalidates the whole request.

Write the conversation the way you would say it, and take the JSON out the other side.

Why the providers differ

OpenAI treats the system prompt as the first message in the array. Anthropic takes it as a separate top-level field and does not accept a system role inside messages.

This is the single most common porting bug between the two, and it fails in a confusing way: the request is accepted and the system prompt is silently ignored or rejected. Selecting the target format here handles the move correctly.

Building training data

The JSONL option emits one compact line, which is what a fine-tuning upload expects. Build your examples one at a time, collect the lines into a file, then run the whole thing through the JSONL validator before uploading.

Frequently asked questions

What happens to multiple system messages?
For the Anthropic format they are concatenated into the single system field, since the API accepts only one. For the OpenAI format they are left in place, though more than one system message is unusual and rarely does what people expect.
How do I include a multi-line message?
This tool reads one message per line. For long multi-line content, build the array here and paste the long content into the resulting JSON, or escape it with the JSON string escaper.

More datasets tools