Arbitrary transformations of JSON in Golang
Clone or download
Pull request Compare This branch is 62 commits behind qntfy:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Travis Build Status Coverage Status MIT licensed GitHub release GoDoc


Kazaam was created with the goal of supporting easy and fast transformations of JSON data with Golang. This functionality provides us with an easy mechanism for taking intermediate JSON message representations and transforming them to formats required by arbitrary third-party APIs.

Inspired by Jolt, Kazaam supports JSON to JSON transformation via a transform "specification" also defined in JSON. A specification is comprised of one or more "operations". See Specification Support, below, for more details.


API Documentation is available at

Specification Support

Kazaam currently supports the following transforms:

  • shift
  • default
  • pass


The shift transform is the current Kazaam workhorse used for remapping of fields. The specification supports jsonpath-esque JSON accesses and sets. Concretely

  "operation": "shift",
  "spec": {
    "": "doc.uid",
    "gid2": "doc.guid[1]",
    "allGuids": "doc.guidObjects[*].id"

executed on a JSON message with format

  "doc": {
    "uid": 12345,
    "guid": ["guid0", "guid2", "guid4"],
    "guidObjects": [{"id": "guid0"}, {"id": "guid2"}, {"id": "guid4"}]
  "top-level-key": null

would result in

  "object": {
    "id": 12345
  "gid2": "guid2",
  "allGuids": ["guid0", "guid2", "guid4"]

The jsonpath implementation supports a few special cases:

  • Array accesses: Retrieve nth element from array
  • Array wildcarding: indexing an array with [*] will return every matching element in an array
  • Top-level object capture: Mapping $ into a field will nest the entire original object under the requested key


A default transform provides the ability to set a key's value explicitly. For example

  "operation": "default",
  "spec": {
    "type": "message"

would ensure that the output JSON message includes {"type": "message"}.


A pass transform, as the name implies, passes the input data unchanged to the output. This is used internally when a null transform spec is specified, but may also be useful for testing.


To start, go get the versioned repository::

go get

Using as an executable program

If you want to create an executable binary from this project, follow these steps (you'll need go installed and $GOPATH set):

go get
cd $GOPATH/src/
go install

This will create an executable in $GOPATH/bin like you would expect from the normal go build behavior.


See godoc examples.