// ReadJSON read data from json file to object
556499
func ReadJSON(fs filesystem.Filespace, src string, object interface{}) error {
	jsonb, err := fs.ReadFile(src)
	if err != nil {
		return err
	}
	return varutil.ObjectFromJSON(object, string(jsonb))
}
1201777
func ReadJSONData(data []byte, detectFormat bool) GossConfig {
	if TemplateFilter != nil {
		data = TemplateFilter(data)
		if debug {
			fmt.Println("DEBUG: file after text/template render")
			fmt.Println(string(data))
		}
	}
	format := OutStoreFormat
	if detectFormat == true {
		format = getStoreFormatFromData(data)
	}
	gossConfig := NewGossConfig()
	// Horrible, but will do for now
	if err := unmarshal(data, gossConfig, format); err != nil {
		// FIXME: really dude.. this is so ugly
		fmt.Printf("Error: %v\n", err)
		os.Exit(1)
	}
	return *gossConfig
}
1128463
func (s *InputSerialization) SetJSON(v *JSONInput) *InputSerialization {
	s.JSON = v
	return s
}
1198467
func GetJson(dat *string, s interface{}) {
	err := json.Unmarshal([]byte(*dat), s)
	if err != nil {
		panic("Get json failed")
	}
}
130033
func (s *SerializableHttpRequest) ToJson() string {
	jsonVal, err := json.Marshal(s)
	if err != nil || jsonVal == nil {
		return fmt.Sprintf("Error marshalling SerializableHttpRequest to json: %s", err)
	}
	return string(jsonVal)
}
252771
func LoadJSON(raw json.RawMessage) (*Config, error) {
	obj, err := hcl.Parse(string(raw))
	if err != nil {
		return nil, fmt.Errorf(
			"Error parsing JSON document as HCL: %s", err)
	}

	// Start building the result
	hclConfig := &hclConfigurable{
		Root: obj,
	}

	return hclConfig.Config()
}
976318
func (F *Frisby) SetJson(json interface{}) *Frisby {
	F.Req.Json = json
	return F
}
984016
func (client *Instance) GetJSON(v interface{}) (statusCode int, err error) {
	statusCode, body, err := client.GET()
	if err != nil {
		return 0, err
	}

	return statusCode, json.NewDecoder(bytes.NewReader(body)).Decode(&v)
}
1318458
func (c *Client) SendJSON(data interface{}) (err error) {
	w, err := c.NextWriter(websocket.TextMessage)
	if err != nil {
		return err
	}
	if data != nil {
		codec.NewEncoder(w, &jh).Encode(data)
	}
	return w.Close()
}
215277
func DeserializeFromJSONFile(path string, objPtr interface{}) error {
	data, err := ReadFile(path)
	if err != nil {
		return err
	}

	err = json.Unmarshal(data, objPtr)
	if err != nil {
		return errors.Wrapf(err, "failed to unmarshal %q as JSON", path)
	}

	return nil
}
87166
func (r Row) GetJSON(colIdx int) json.BinaryJSON {
	col := r.c.columns[colIdx]
	start, end := col.offsets[r.idx], col.offsets[r.idx+1]
	return json.BinaryJSON{TypeCode: col.data[start], Value: col.data[start+1 : end]}
}
241580
func LoadJSON(path string, marshal json.Unmarshaler) error {
	j := NewJSON(path, marshal)
	watch(j)
	j.Load()
	return j.err
}
464152
func LoadJSON(filename string) *Graph {
	js, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil
	}
	return ParseJSON(js)
}
1078720
func readGeoJSON(db *sql.DB, r io.Reader) error {
	var waypoint Waypoint
	if err := json.NewDecoder(r).Decode(&waypoint); err != nil {
		return err
	}
	var geometry geom.T
	if err := geojson.Unmarshal(waypoint.Geometry, &geometry); err != nil {
		return err
	}
	point, ok := geometry.(*geom.Point)
	if !ok {
		return errors.New("geometry is not a point")
	}
	_, err := db.Exec(`
		INSERT INTO waypoints(name, geom) VALUES ($1, $2);
	`, waypoint.Name, &ewkb.Point{Point: point.SetSRID(4326)})
	return err
}
711954
func (c *ctx) JSON(data interface{}) error {
	b, err := json.Marshal(data)
	if err != nil {
		return err
	}
	return c.raw(b, contentTypeJSON)
}
955246
func GetJSON(dat *string, s interface{}) error {
	return json.Unmarshal([]byte(*dat), s)
}
12588
func (r *Resp) ToJSON(v interface{}) error {
	data, err := r.ToBytes()
	if err != nil {
		return err
	}
	return json.Unmarshal(data, v)
}