Skip to content

fix: preserve scalar keys ending in "[]" across stringify/parse - #312

Open
spokodev wants to merge 1 commit into
npm:mainfrom
spokodev:fix/scalar-key-ending-in-brackets
Open

spokodev wants to merge 1 commit into
npm:mainfrom
spokodev:fix/scalar-key-ending-in-brackets

Conversation

@spokodev

@spokodev spokodev commented Sep 2, 2026

Copy link
Copy Markdown

ini.parse(ini.stringify(obj)) corrupts a scalar key that ends in []. stringify emits e.g. foo[]=bar, which is indistinguishable from the bracketedArray array marker, so parse strips the [] and wraps the value in an array — { 'foo[]': 'bar' } round-trips to { foo: ['bar'] }. Because bracketedArray defaults to on, this happens with the default options.

stringify now quotes a scalar key ending in [] (only in bracketedArray mode), and parse treats a quoted key literally rather than as an array marker. Real arrays and every existing case are unaffected — full suite green, 100% coverage.

@spokodev
spokodev requested a review from a team as a code owner September 2, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant