A dependency-free Go parser for JSON Forms schemas. Produces a type-safe AST for building custom renderers.
- All Standard Elements - Control, Layout, Group, Categorization, Category, Label
- Custom Elements - Unknown types preserved with parsed children
- Rules & Conditions - HIDE/SHOW/ENABLE/DISABLE with schema-based, leaf, AND, OR conditions
- Visitor Pattern - Traverse and transform the AST
- Type-Safe - Strongly-typed nodes, no generic maps
- Zero Dependencies - Pure Go stdlib
go get github.com/tinybluerobots/jsonforms-parserimport "github.com/tinybluerobots/jsonforms-parser"
ast, err := jsonforms.Parse(uiSchemaJSON, schemaJSON)
if err != nil {
log.Fatal(err)
}
layout := ast.UISchema.(*jsonforms.VerticalLayout)
control := layout.Elements[0].(*jsonforms.Control)
fmt.Println(control.Scope) // "#/properties/name"All elements implement UISchemaElement:
Control- Binds UI to data propertyVerticalLayout,HorizontalLayout- Layout containersGroup- Labeled containerCategorization,Category- Tab navigationLabel- Static textCustomElement- Unknown/custom types
type MyVisitor struct {
jsonforms.BaseVisitor
}
func (v *MyVisitor) VisitControl(c *jsonforms.Control) error {
fmt.Println("Found:", c.Scope)
return nil
}
jsonforms.Walk(ast.UISchema, &MyVisitor{})Build custom renderers, transform schemas, validate structures, generate docs, or convert between form systems.