Skip to content
/ jsn Public

Go package to easily construct JSON without defined types.

License

Notifications You must be signed in to change notification settings

cristalhq/jsn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsn

build-img pkg-img version-img

Go package to easily construct JSON without defined types.

Features

  • Very simple API.
  • Dependency-free.
  • Clean and tested code.

See docs for more details.

Install

Go version 1.18+

go get github.com/cristalhq/jsn

Example

j := jsn.O{
	"hello": "world",
	"do": jsn.A{
		"go", "mod", "tidy",
	},
	"x": jsn.N("123456.00000000000000000000000000000000000000001"),
}

raw, _ := json.MarshalIndent(j, "", "  ")
fmt.Printf("%s\n", raw)

// Output:
//{
//   "do": [
//     "go",
//     "mod",
//     "tidy"
//   ],
//   "hello": "world",
//   "x": 123456.00000000000000000000000000000000000000001
//}

See examples: example_test.go.

License

MIT License.