Skip to content

jsonflat v0.1.0

Choose a tag to compare

@github-actions github-actions released this 22 Sep 11:27
· 8 commits to main since this release

Added

  • jsonflat package: Compile, MustCompile, New, and a Transformer with
    Append, Transform and Each.
  • 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, expose and newline.
  • keys.keep: an output-key whitelist next to keys.drop. A flattened key is
    written only if it matches keep (when set) and does not match drop.
  • keys.rest: a column that collects the keys keep left out, as a JSON
    string of one flat object, so a whitelist loses nothing.
  • Sources with fallbacks: paths, $now, derived values, Options.Vars, and
    the clock_skew function.
  • Zero heap allocations in Append and Each in the steady state, guarded by
    tests.
  • Output that is always valid JSON: an RFC 8259 string escaper and number check
    in internal/jsonenc, because the parser's own serialiser and number parsing
    are more lenient than the standard.
  • presets package 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 FuzzAppend and FuzzEach, 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