form2js API Reference

March 21, 2026 ยท View on GitHub

This section is for developers who want the exact API surface of the current @form2js/* packages, plus the defaults and edge cases that usually matter when you wire forms into real applications.

If you want the broader project overview first, start with README.md.

Who this is for

  • Developers choosing between the @form2js/* packages
  • Teams migrating from the legacy form2js flow to package-specific APIs
  • Anyone who needs exact options, exported types, and behavior notes

Package Guide

Shared Naming Rules

These rules apply across parser-based packages such as core, dom, and form-data.

  • Dot paths build nested objects: person.name.first becomes { person: { name: { first: ... } } }
  • Repeated [] pushes into arrays in encounter order: roles[]
  • Indexed arrays are compacted in first-seen order: items[8], items[5] becomes indexes 0, 1
  • Rails-style brackets are supported: rails[field][value]
  • By default, empty string and null are skipped (skipEmpty: true)
  • Unsafe key path segments (__proto__, prototype, constructor) are rejected by default