Skip to content

Main content

Restricted INI Record Document Formatter

Format normalized explicit INI records preserving occurrence order, re-emitting section headings on changes; values must be single-line trimmed literals, no quoting or interpolation.

Loading tool…

Description

Format normalized explicit INI records preserving occurrence order, re-emitting section headings on changes; values must be single-line trimmed literals, no quoting or interpolation.

INI-like configuration formats vary between applications. In this tool family, assignments are explicit section/name/value records and the empty section string means global scope. Duplicate-key policies, case handling and preservation of comments are separate choices rather than one universal INI behavior.

Format normalized explicit INI records preserving occurrence order, re-emitting section headings on changes; values must be single-line trimmed literals, no quoting or interpolation.

When to use this tool

Use this tool to format normalized explicit INI records preserving occurrence order, re-emitting section headings on changes; values must be single-line trimmed literals, no quoting or interpolation.

How to use the tool and how it works

  1. Enter recordsJson using the field definitions below. For JSON text, serialize the explicit records in the shown shape.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.text. Use the ordering, boundary rules and absence conditions described below.

Emit key=value lines in record order and emit a section header whenever the section changes, joined with LF. Reject a return to global scope after a section.1

Input fieldMeaning and unitsAccepted input
recordsJsonJSON text encoding array of {section: string, name: string, value: string}. Keep the record keys and value types shown in the decoded example below.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.

These are the decoded structures used in the example’s JSON text fields. Supply the corresponding serialized JSON strings as input.

json
{
  "recordsJson": [
    {
      "section": "a",
      "name": "x",
      "value": "1"
    },
    {
      "section": "b",
      "name": "x",
      "value": "3"
    }
  ]
}
Output fieldInterpretation
resultObject containing the named fields below.
result.textNormalized document text using LF line endings.
json
{
  "input": {
    "recordsJson": "[{\"section\": \"a\", \"name\": \"x\", \"value\": \"1\"}, {\"section\": \"b\", \"name\": \"x\", \"value\": \"3\"}]"
  },
  "output": {
    "result": {
      "text": "[a]\nx=1\n[b]\nx=3"
    }
  }
}

Limitations and assumptions

  • This normalized dialect discards comments and layout; values cannot have surrounding whitespace and key ambiguity is rejected.
  • Assignment records contain section, name and value strings. Nonempty section/key names cannot have surrounding whitespace, brackets or CR/LF/NUL. Values cannot contain CR/LF/NUL; a key cannot contain equals. No implicit interpolation or typed-value conversion is performed.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Select the consuming application’s dialect and duplicate-key policy explicitly. Use a lossless configuration editor when comments, original spacing, quoting or application-specific interpolation must be preserved.

References

  1. Tool behavior and example: Restricted INI Record Document Formatter — tool.io

Similar or alternative tools

  • INI Section Name Line Formatter

    Format a literal nonempty trimmed INI section name for the restricted bracketed dialect; no escaping, nesting or case normalization.

  • INI Comment Line Classifier

    Classify whole-line comments in a restricted INI dialect using first non-SP/HTAB semicolon or hash; not inline comment stripping or quote handling.