Skip to content

Go json-utils package for removing comments from JSON files.

License

Notifications You must be signed in to change notification settings

ssratkevich/json-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-utils

Go json-utils package for removing comments and trailing commas from JSON files. It also checks for BOM and removes it if necessary.

Fast usage sample:

import (
    "encoding/json"
    "os"
    json_utils "github.com/ssratkevich/json-utils"
)

func getData(name string) (any, error) {
    src, err := os.ReadFile(name)
    if err != nil {
        return nil, err
    }
    src = json_utils.FixJson(src)
    // parsing and handling JSON
    var data any
    err = json.Unmarshal(src, &data)
    return data, err
}

About

Go json-utils package for removing comments from JSON files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages