Skip to content

GroundSix/jconfig

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jconfig

Build Status Bitdeli Badge

This is a Go package to parse a configuration file using JSON.

It was ogirinally developed by Stathat but we are maintaining a fork of it here due to it being a dependency to other projects we maintain.

Installation

$ go get github.com/stathat/jconfig

Usage

import (
    "github.com/groundsix/jconfig"
)

Example

Here is our example JSON file:

{
    "name" : "Harry",
    "age"  : 22,
    "pets" : ["Dog", "Cat"]
}

And to make use of this data:

package main

import (
    "fmt"
    "github.com/groundsix/jconfig"
)

func main() {
    config := jconfig.LoadConfig("path/to/your/config.json")

    name := config.GetString("name")
    age  := config.GetInt("age")
    pets := config.GetArray("pets")

    fmt.Println(pets[0]) // Dog
}

See config.go for full API and types that can be pulled from your config file.

Running Tests

$ make test

About

Originally written by Patrick Crosby at StatHat. (@stat_hat)

Fork currently being maintained by Ground Six. (@groundsix)

License

MIT

About

Simple JSON configuration file parser.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%