mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-10-31 16:27:41 -04: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
|
|
}
|