mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-06 18:28:00 -05:00
21 lines
336 B
Go
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
|
|
}
|