Chat to Messages JSON Converter
For developers writing tests, few-shot examples or API calls from a drafted conversation. You get a messages array with system, user and assistant roles, ready to paste into a request body.
Close the gaps with real-world projects
Build industry projects on ByteLabs and add verified proof of your skills to your public profile.
How to use the Chat to API JSON
- Enter an optional system prompt.
- Write the conversation with one user: or assistant: line per turn.
- Click Build messages JSON.
- Copy the JSON into your API request.
An example, step by step (example only)
You enter
System: You are a concise assistant. Lines: user: What is a container? / assistant: A lightweight, isolated package of an app. / user: How is it different from a VM?
The tool shows
{"messages": [...]} with 4 messages in order: system, user, assistant, user
Questions about the Chat to API JSON
What is the messages format in chat completion APIs?
It is an ordered list of objects, each with a role (system, user or assistant) and content. The model reads the whole list to produce the next assistant turn.
How do I add multi-line messages?
Start a turn with user: or assistant:, and any following line without a role prefix is appended to that same message.
Is the output the same for every provider?
The role and content shape matches OpenAI-style chat APIs. Some providers take the system prompt as a separate field, so move it if your API asks for that.
Is the Chat to API JSON free and private?
Yes. It is free, needs no sign-up and runs entirely in your browser, so what you type is not uploaded. You only sign in if you want to email a result to yourself or save it to your CareerByteCode profile.