Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.
/ tj Public archive

Go library to construct JSON without backing it up with Go structures

License

Notifications You must be signed in to change notification settings

ridge/tj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Construct JSON without backing it up with Go structures

Go Reference

This repository is archived. See https://github.com/dottedmag/tj for the current version.

Use tj to produce well-formed schemaless JSON:

json.Marshal(tj.O{
    "hello": tj.A{
        "world",
        42,
        tj.O{
            "go": nil,
        },
    },
})

tj/json2go tool produces tj trees from existing JSON or YAML files.

Why whould I need that?

This package comes in handy for interacting with large amounts of external systems all demanding different JSON schemas. Creating structures, tagging them and filling them is overkill if the structures are used just once.

Why do I need this package to do so?

tj.O and tj.A are short and unobtrusive, this makes the resulting code readable.

Is it always a good idea to use this package?

If you find yourself using tj to describe JSONs with the same schema more than once then it's time to switch to Go struct-backed JSON generation.

Legal

Copyright Tectonic Labs Ltd.

Licensed under Apache 2.0 license.

Authors:

About

Go library to construct JSON without backing it up with Go structures

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages