Repository navigation
jsonflat v0.1.0
Added
jsonflatpackage:Compile,MustCompile,New, and aTransformerwith
Append,TransformandEach.- Config sections
input(explode, inherit),flatten(separator, arrays,
max_depth, drop_nulls, drop_empty_objects),keys(snake_case normalisation,
digit prefix, collision policy, segment aliases, aliases, keep, drop),
derive,columns,sections,rules(rename, drop, merge, default),
outputs,exposeandnewline. keys.keep: an output-key whitelist next tokeys.drop. A flattened key is
written only if it matcheskeep(when set) and does not matchdrop.keys.rest: a column that collects the keyskeepleft out, as a JSON
string of one flat object, so a whitelist loses nothing.- Sources with fallbacks: paths,
$now, derived values,Options.Vars, and
theclock_skewfunction. - Zero heap allocations in
AppendandEachin the steady state, guarded by
tests. - Output that is always valid JSON: an RFC 8259 string escaper and number check
ininternal/jsonenc, because the parser's own serialiser and number parsing
are more lenient than the standard. presetspackage with the RudderStack warehouse-schema preset.example/: a command that flattens an NDJSON event export (gzip or plain)
into one flat row per line, merging duplicate keys and duplicate fields
through its config, with an optional independent check of every row.- Fuzz targets
FuzzAppendandFuzzEach, benchmarks, and examples.
Install
go get github.com/nayan9229/jsonflat@v0.1.0
API reference: https://pkg.go.dev/github.com/nayan9229/jsonflat@v0.1.0