Popularity
2.0
Growing
Activity
5.0
-
22
2
1

Description

A TOML parser and JSON encoder. TOML 1.0 compliant.

This pkg is not released yet bug reports and suggestions are welcome.

Programming language: Go
License: MIT License
Tags: Utilities     Configuration     Golang    

TOML alternatives and similar packages

Based on the "Configuration" category.
Alternatively, view toml alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of TOML or a related project?

Add another 'Configuration' Package

README

Go Report Card GoDoc

TOML

A TOML parser and JSON encoder.

TOML 1.0 compliant

give it a try

Installation:

go get github.com/komkom/toml

Unmarshaling a toml doc

Since the parser transforms a toml in stream into a valid json, normal json unmarshaling from the std lib can be used.

doc := `
[some]
toml="doc"`

dec := json.NewDecoder(toml.New(bytes.NewBufferString(doc)))

st := struct {
  Some struct {
    Toml string `json:"toml"`
  } `json:"some"`
}{}

err := dec.Decode(&st)
if err != nil {
  panic(err)
}

fmt.Printf("toml: %v\n", st.Some.Toml)

Performance Considerations

In the repo there are two benchmarks comparing throughputs of just reading data from memory versus also transforming and parsing the data. The parser slows down data throughput around 15x here. These benchmarks are by no means thorough and only hints at an estimate.

Parser Throughput    7.05 MB/s
Memory Throughput    100.03 MB/s