1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-10-31 16:27:41 -04:00
v2fly/infra/conf/json/toml.go
2021-09-04 11:11:45 +01:00

21 lines
336 B
Go

package json
import (
"encoding/json"
"github.com/pelletier/go-toml"
)
// FromTOML convert toml to json
func FromTOML(v []byte) ([]byte, error) {
m := make(map[string]interface{})
if err := toml.Unmarshal(v, &m); err != nil {
return nil, err
}
j, err := json.Marshal(m)
if err != nil {
return nil, err
}
return j, nil
}