1
0
mirror of https://github.com/TomWright/dasel.git synced 2022-05-22 02:32:45 +03:00
Files
dasel-data-selector/internal/storage/json.go
2020-09-22 15:06:37 +01:00

20 lines
458 B
Go

package storage
import (
"encoding/json"
"fmt"
)
// JSONParser is a Parser implementation to handle yaml files.
type JSONParser struct {
}
// FromBytes returns some Data that is represented by the given bytes.
func (p *JSONParser) FromBytes(byteData []byte) (interface{}, error) {
var data interface{}
if err := json.Unmarshal(byteData, &data); err != nil {
return data, fmt.Errorf("could not unmarshal config data: %w", err)
}
return data, nil
}