Skip to main content

JSON to SOML

Convert JSON objects and arrays to SOML in your browser. Preserve exact 64-bit integers, then copy the result or download a .soml file.

Input
JSON
Output
SOML

What is a JSON to SOML converter?

A JSON to SOML converter rewrites an existing JSON document as a SOML configuration file. It keeps nested objects and arrays in the same structure while using SOML syntax. For example, a top-level object’s outer braces can be omitted, and simple keys such as service can be written without quotes.

Use it when starting a SOML config from a JSON file or adapting a JSON fixture for a tool that reads SOML. Check that the application you plan to use supports the format. SOML is described in the draft SOML specification.

How to convert JSON to SOML

  1. Paste a JSON object or array, open a UTF-8 .json or .txt file, or select Example.
  2. Select Convert.
  3. Review the output. Select Copy to copy it or Download to save a .soml file.

The converter accepts up to 1 MiB of input. Conversion runs in your browser.

JSON to SOML example

This JSON config includes a nested server object, an ID larger than JavaScript’s safe integer range, and a timeout stored as text.

{
"service": "api",
"server": {
"ports": [80, 443],
"tls": true
},
"buildId": 9007199254740993,
"timeout": "30s",
"sampleRate": 1.0
}

SOML output:

service: 'api'
server: {
ports: [
80
443
]
tls: true
}
buildId: 9007199254740993
timeout: '30s'
sampleRate: 1.0

The build ID keeps every digit. The quotes around '30s' keep it a string. In SOML, removing those quotes would make it a duration, so make that change only if your application expects one.

How JSON values map to SOML

JSON inputSOML result
Objects and arraysKeep their nested structure. Either can be the top-level value.
StringsStay strings, including values that look like dates or durations.
Booleans and nullStay true, false, or null.
Integer literals such as 3Become exact integers within the signed 64-bit range.
Decimals and exponent notation such as 3.0 and 3e0Become floating-point values. Both examples produce 3.0.

Signed 64-bit integers range from -9223372036854775808 to 9223372036854775807. An integer outside that range produces an error. Decimal and exponent inputs use binary64 rounding, and negative zero becomes zero. Inputs that overflow or are nonzero but too small to avoid rounding to zero also produce an error.

Troubleshooting

Why is my JSON rejected?

The converter expects strict JSON. Remove comments and trailing commas and use double quotes around keys and strings. If a key appears twice in the same object, choose which value to keep or rename one of the keys before converting. Use JSON Validator to check syntax separately.

Why is a valid JSON string rejected at the top level?

A JSON value such as "api" or null is valid on its own, but a SOML document must be an object or array. Wrap a standalone value in an object or array if that structure suits your application.

Why does a JSON string containing a carriage return fail?

SOML does not represent carriage returns inside values. A JSON string with the escape \r can therefore fail even though the JSON syntax is valid. Change the source string only if a line feed or another replacement is suitable for your data.

JSON to SOML FAQ

What happens to keys with spaces or dots?

The converter quotes keys that need it. For example, a JSON key named api.port becomes the SOML key 'api.port'. It remains one key and does not create a nested object.

Can I convert the result back to JSON?

Use SOML to JSON for the reverse direction. If you edit the SOML and add comments or typed dates, timestamps, or durations, those additions cannot round-trip through JSON unchanged.