logfmt to JSON Converter

Convert logfmt key=value logs to JSON and back, right in your browser. Your log lines stay on your device.

Your log lines are converted locally in your browser and never uploaded, but avoid pasting logs that contain real secrets, tokens, or personal data into any tool.

Need to reshape the JSON further? Try the JSON Formatter.

About logfmt to JSON

This logfmt to JSON converter turns key=value structured log lines into clean JSON objects, and can convert JSON back to logfmt. logfmt is the line-oriented format you see in Heroku router logs, Grafana Loki, and Go services using log/slog, where each line is a series of key=value pairs. As a logfmt parser it respects double-quoted values that contain spaces or an equals sign, treats a bare key with no value as the boolean true, and optionally coerces true, false, and numeric strings into real JSON types. Each line becomes one object; multiple lines become a JSON array so you can pipe a whole log excerpt through at once. It is built for backend engineers and SREs who want their logs shaped for a script or a dashboard. The conversion runs entirely in your browser, so the log lines you paste are processed locally and never leave your device.

Features

How to use the logfmt to JSON

  1. Pick a direction: logfmt to JSON, or JSON to logfmt.
  2. Paste your log lines or JSON into the input box on the left.
  3. Toggle Coerce types on or off to control number and boolean detection.
  4. Read the converted output on the right, then Copy it or download the file.

Example

Input

level=info msg="hello world" count=3 ok=true

Output

{
  "level": "info",
  "msg": "hello world",
  "count": 3,
  "ok": true
}

A quoted value keeps its spaces, while count and ok are coerced to a number and a boolean.

Common errors & troubleshooting

Frequently asked questions

What is logfmt?
logfmt is a simple, line-oriented logging format where each line is a series of key=value pairs, such as level=info msg="started" count=3. It is widely used by Heroku, Grafana Loki, and Go services because it is readable by humans and easy for machines to parse.
How are quoted values handled?
Double-quoted values are kept intact, so spaces and equals signs inside the quotes stay part of the value, for example msg="a=b c=d" parses to the string "a=b c=d". Quoted values are always treated as strings and are never coerced to numbers or booleans.
What does the Coerce types toggle do?
With coercion on, bare values of true and false become JSON booleans and numeric strings like 200 or 0.5 become JSON numbers. Turn it off to keep every value as a string, which is useful when identifiers such as 007 must stay exactly as written.
How is a key with no value converted?
A lone key with no equals sign, like debug, is a logfmt flag and becomes true in the JSON output. This follows the common logfmt convention that a bare key signals a boolean that is set.
Can I convert JSON back to logfmt?
Yes. Switch the direction to JSON to logfmt and paste an object or an array of objects. Each object becomes one logfmt line, and values containing spaces, equals signs, or quotes are automatically double-quoted.
Are my log lines uploaded anywhere?
No. The logfmt and JSON conversion runs entirely in your browser, so the log lines you paste are processed locally on your device and are never sent to a server.

Related tools

All ArrayKit tools