1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-09 11:51:02 -05:00
v2fly/infra/conf/json/toml.go

21 lines
336 B
Go
Raw Normal View History

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
}