YourTools.
简体中文
Back to the catalog
Tools

Key-value pairs to code

Turn key=value or key: value lines into JSON, YAML, .properties, .env, TypeScript, Python, PHP, Java, C#, Go, HTML options or SQL.

Process locally

Files stay in this browser session. Closing or clearing releases them.

Add text

Type or paste the text to process

Adjust settings

Optional: Separator, Code, Variable or table name and more

Key-value pairs to code

Run

Processes in this browser; cancel at any time

Add text first

About this tool

Turn lines of key=value or key: value into code or config: JSON, YAML, .properties, .env, a TypeScript or JavaScript object, a Python dict, a PHP array, a Java Map, a C# Dictionary, a Go map, HTML <option> tags or a SQL INSERT. Use it to move settings between formats, fill a dropdown from a list, or turn a config dump into test data.

The separator can be detected for you, values can stay text or be written as numbers, true/false and null, and blank lines and comment lines are skipped. Up to 1 MB of text is converted in your browser and is not uploaded.

How to use it

  1. Enter one key and value per line, such as name=Alice or city: Shanghai, or select “Use example”.
  2. Choose the “Separator”, or leave it on “Detect”, and pick the output format under “Code”.
  3. Set the “Variable or table name” (data by default), and tick “Write numbers, true/false and null without quotes” if you want typed values.
  4. Select “Run”, then preview the code and download it with the matching extension, such as code.json or code.py.

Formats and limits

Input
Text
Output
Text
Size limit
1 MB
Settings
Separator (Detect, =, :, Tab, Comma, Space); Code; Variable or table name; Write numbers, true/false and null without quotes
Privacy
Files stay in the current browser session. No file bytes are uploaded.
Price
Free, no sign-up

Common questions

How is the separator detected?

“Detect” tries =, then tab, then a colon (: or :), then a comma (, or ,), then spaces, and uses the first one found in every line. Each line is split at its first separator only, so with = a value such as https://example.com keeps its colons.

Which lines are skipped?

Blank lines and lines starting with #, // or ; are treated as comments and ignored. Quotes around a value are removed, so name='Alice' gives Alice.

Which formats write typed values?

With the option ticked, JSON, YAML, TypeScript, JavaScript, Python, PHP and SQL write numbers, true/false and null without quotes. .properties, .env, Java, C#, Go and HTML options always keep values as text, and the Java, C# and Go maps are declared with string values.

What happens to keys in .env and .properties?

.env keys are turned into upper case with other characters replaced by _, so api-url becomes API_URL. In .properties, non-ASCII characters such as Chinese are written as \uXXXX escapes.

What if a key appears twice?

JSON keeps only the last value for that key. The other formats write every line as it is.