bafi

command module
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 38 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

bafi

Convert JSON, XML, CSV, YAML, BSON and MT940 into any text format with templates.

One small command-line program for Windows, macOS and Linux. Read a file or a pipe, describe the output with a Go template, get JSON, XML, CSV, HTML, SQL, a SOAP request - anything that is text.

bafi -i orders.xml -t '?{{toJSON .}}'                              # XML to JSON
bafi -i users.csv -d ';' -t '?{{toJSON .}}'                        # CSV (semicolon) to JSON
curl -fs https://example.com/api/users | bafi -f json -t '?{{toXML .}}'   # REST response to XML
bafi -i sales.json -t report.tmpl -o report.html                    # HTML report from a template

Documentation · Recipes · Install · Download · Changelog

input formats to any output

Recipes

Step-by-step, tested examples for common tasks: XML to JSON · JSON to XML · CSV to JSON · JSON to CSV · XML to CSV · REST to SOAP · SOAP to JSON · HTML report · SQL INSERTs from CSV · MT940 to CSV · Merge several files · more

Key features

  • Input: JSON, BSON, YAML, CSV (any delimiter), XML and MT940 bank statements, from a file or standard input; several files of different formats can be merged into one output.
  • Output: whatever the template produces. 60+ template functions for math, dates, strings and conversions, plus your own in Lua.
  • Errors point at the file, line and column, with a hint how to fix them.
  • Encode data as TOON for LLM prompts, or ask OpenAI about your data (experimental).
  • Try it in the browser without installing anything.

Go CodeQL Go Report Card License Mentioned in Awesome Go GitHub tag (latest by date)

If you like this app you can buy me a coffee ;)

Buy Me a Coffee at ko-fi.com

Documentation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址