Schema alignment
Connect a form template to JSON
Merge the connected JSON before mapping to expose the naming problem. Then map inconsistent field names and merge again to populate the complete editable form.
JSON DATA
Properties to match
EDITABLE
MAPPING RESULT
0 fields renamed
72% MIN
0Form fields
0JSON names
0Skipped
0 msServer time
DECISION TRACE
Template field mappings
EXPLAINABLE
DISCOVERED SCHEMA
Available JSON names
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Normalize independently maintained templates and data
Form templates and JSON APIs rarely evolve with identical naming conventions. A deterministic matcher can align them before population or merge processing without sending document content to an external service.
Key members
Open the template
ServerTextControl.Load
Enumerate fields
ServerTextControl.FormFields
Rename a field
FormField.Name
Preselect form values
MailMerge.FormFieldMergeType
Connect JSON data
TXTextControl.loadJsonData
Edit the mapped template
TXTextControl.loadDocument
How the matcher works
JSON parsing collects both leaf names and complete nested paths. Field names are split across camel case, underscores, numbers, and punctuation, then normalized into comparable token sets.
Each template field is scored using normalized equality, token-set overlap, token containment, and Levenshtein similarity. A candidate is accepted only when it clears the selected threshold and is sufficiently better than the runner-up.
Mapping changes field names but not values. The second step saves the mapped editor document and passes it to MailMerge. FormFieldMergeType.Preselect fills matching controls while preserving them as editable form fields.
var mapper = new FormFieldMapper(jsonFieldNames, minimumScore);
var results = mapper.RenameFormFields(textControl.FormFields);
// Accepted decisions update the template itself.
field.Name = decision.JsonName;
Technique adapted from Automatically Mapping Form Fields to JSON Data.
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0