I Help You

List to Code Object

Convert key=value pairs into a JSON object, JavaScript object, PHP array, or Python dictionary. Free, and it runs entirely in your browser — nothing you enter is uploaded.

How to use the List to Code Object

1. Enter your key-value pairs in the input, one per line. Use key=value or key: value format.

2. Choose the separator character (Auto-detect works for most inputs).

3. Enter an optional variable name for the generated object.

4. Select your target language and copy the generated object code.

What is it?

This tool converts a plain list of key-value pairs into a native object or dictionary for your chosen programming language. Input one pair per line using either key=value (common in .env files and config files) or key: value (common in YAML and HTTP headers).

The output adapts to each language's object syntax: JSON uses double-quoted keys and values, JavaScript uses a const object literal with proper quoting, PHP generates an associative array using the => operator, and Python generates a dictionary literal. All keys and values are properly escaped.

Example

Key-value pairs
name=Alice
role=developer
city=London
↓
JSON object
{
  "name": "Alice",
  "role": "developer",
  "city": "London"
}

Switch the output language tab to generate a JavaScript object, PHP associative array, or Python dictionary.

Benefits

Convert key=value pairs into a code object for any language

Paste .env-style or properties-file key=value content and get a JavaScript object, Python dict, PHP array, or JSON object.

Transform config file content into code-ready object literals

Convert .env, .properties, and INI file content to the exact object structure your application code expects.

Build test data objects from readable specifications

Write test data in a plain key=value format and get the language-appropriate object literal for your test file.

Eliminate boilerplate for small config and mapping objects

Turn a list of key=value pairs directly into object syntax without writing the language-specific brackets and colons manually.

Frequently asked questions

Can I use colons instead of equals signs?

Yes — set the separator to ': (colon)' or leave it on Auto-detect. Auto-detect checks whether the input contains '=' and falls back to ':' if not.

What if a value itself contains the separator character?

Only the first occurrence of the separator on each line is used as the split point. Everything after it (including additional separators) is treated as part of the value.

Are numeric values output as numbers or strings?

All values are output as strings. If you need numeric types in your code, you will need to manually adjust the output (e.g., remove the quotes around numbers).

Can I use this to parse .env files?

Yes — .env files use KEY=VALUE format per line, which this tool reads directly. Set the separator to '= (equals)' for guaranteed accuracy. Comments (lines starting with #) that don't contain '=' are automatically ignored.