// PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
//
// See: jsonhooks-v1/jsonhooks.Unmarshal()
427273
func (groups *Groups) PostUnmarshalJSON() error {
	groups.Init()
	for key, group := range groups.Groups.Items {
		groups.Groups.Items[key].parent = groups
		if err := group.PostUnmarshalJSON(); err != nil {
			return err
		}
	}

	groups.Complete <- true

	return nil
}
546150
func (o *NatGateway) UnmarshalJSON(data []byte) error {
	var jsonName string
	if err := json.Unmarshal(data, &jsonName); err == nil {
		o.Name = &jsonName
		return nil
	}

	var r realNatGateway
	if err := json.Unmarshal(data, &r); err != nil {
		return err
	}
	*o = NatGateway(r)
	return nil
}
357265
func (b *Bucketpoint) UnmarshalJSON(payload []byte) error {
	bp := bucketpointJSON{}
	err := json.Unmarshal(payload, &bp)
	if err != nil {
		return err
	}

	*b = Bucketpoint(bp.bucketpoint)
	b.Start = FromUnixMilli(bp.StartTs)
	b.End = FromUnixMilli(bp.EndTs)

	return nil
}
1164123
func (j *Json) UnmarshalJSON(p []byte) error {
	dec := json.NewDecoder(bytes.NewBuffer(p))
	dec.UseNumber()
	return dec.Decode(&j.data)
}
485604
func (v *Endpoint) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson72863a49DecodeGithubComSignalfxGolibTraceFormat2(&r, v)
	return r.Error()
}
228908
func (h *Http) PostJson(urlStr string, body interface{}, target interface{}) (error, int) {
	bodyBytes, err := json.Marshal(body)
	if err != nil {
		return err, -1
	}

	req := &http.Request{
		Method: "POST",
		Header: map[string][]string{
			"Content-Type": {"application/json"},
		},
		Body: ioutil.NopCloser(bytes.NewReader(bodyBytes)),
		ContentLength: int64(len(bodyBytes)),
	}

	resp, err := h.executeRequest(urlStr, req)
	if err != nil {
		return err, -1
	}

	defer resp.Body.Close()
	jsonData, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return err, -1
	}

	logResponse(urlStr, resp, jsonData)

	if resp.StatusCode < 200 || resp.StatusCode > 299 {
		return errors.New(fmt.Sprintf("Expected code %s but got %d,\n response: [%s]",
			"20x", resp.StatusCode, string(jsonData))), resp.StatusCode
	}

	if target != nil {
		err = json.Unmarshal(jsonData, target)
		if err != nil {
			return err, resp.StatusCode
		}
	}

	return nil, resp.StatusCode
}
393006
func PostJSON(ctx context.Context, rFn retry.Factory, c *http.Client, url string, headers map[string]string, in, out interface{}) (int, error) {
	req, err := NewRequestJSON(ctx, c, rFn, url, "POST", headers, in, out)
	if err != nil {
		return 0, err
	}
	return req()
}
1248948
func (h *Headers) UnmarshalJSON(data []byte) error {
	if h == nil {
		return errors.New("network.Headers: UnmarshalJSON on nil pointer")
	}
	*h = append((*h)[0:0], data...)
	return nil
}
289044
func (o *RouteTable) UnmarshalJSON(data []byte) error {
	var jsonName string
	if err := json.Unmarshal(data, &jsonName); err == nil {
		o.Name = &jsonName
		return nil
	}

	var r realRouteTable
	if err := json.Unmarshal(data, &r); err != nil {
		return err
	}
	*o = RouteTable(r)
	return nil
}
1145393
func (x *OrderResponse) UnmarshalJSON(data []byte) (err error) {
	x2 := orderResponse{}
	if err = json.Unmarshal(data, &x2); err == nil {
		if x2.Contained != nil {
			for i := range x2.Contained {
				x2.Contained[i] = MapToResource(x2.Contained[i], true)
			}
		}
		*x = OrderResponse(x2)
		return x.checkResourceType()
	}
	return
}
1132610
func (availableBehaviors *AvailableBehaviors) PostUnmarshalJSON() error {
	availableBehaviors.Init()

	for key := range availableBehaviors.Behaviors.Items {
		availableBehaviors.Behaviors.Items[key].parent = availableBehaviors
	}

	availableBehaviors.Complete <- true

	return nil
}
752724
func (v *JSONDatapointV1) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson3b0ebf6aDecodeGithubComSignalfxGatewayProtocolSignalfxFormat2(&r, v)
	return r.Error()
}
186827
func (v *startMessageParams) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson639f989aDecodeCodeCloudfoundryOrgGorouterMbus(&r, v)
	return r.Error()
}
453294
func (resp *OpenIDTokenResponse) UnmarshalJSON(data []byte) (err error) {
	o2 := openIDTokenResponse{}
	if err = json.Unmarshal(data, &o2); err == nil {
		*resp = OpenIDTokenResponse(o2)
		now := time.Now()
		resp.Expiration = now.Add(time.Duration(resp.ExpiresIn) * time.Second)
		return
	}
	return
}
737831
func (i *IP) UnmarshalJSON(data []byte) (err error) {
	if i == nil {
		*i = IP{}
	}

	var fields map[string]interface{}
	if err := json.Unmarshal(data, &fields); err != nil {
		return err
	}

	value := fmt.Sprintf("%v", fields["SUBID"])
	if len(value) == 0 || value == "<nil>" || value == "0" {
		i.ID = ""
	} else {
		id, err := strconv.ParseFloat(value, 64)
		if err != nil {
			return err
		}
		i.ID = strconv.FormatFloat(id, 'f', -1, 64)
	}

	value = fmt.Sprintf("%v", fields["DCID"])
	if len(value) == 0 || value == "<nil>" {
		value = "0"
	}
	region, err := strconv.ParseInt(value, 10, 64)
	if err != nil {
		return err
	}
	i.RegionID = int(region)

	value = fmt.Sprintf("%v", fields["attached_SUBID"])
	if len(value) == 0 || value == "<nil>" || value == "0" || value == "false" {
		i.AttachedTo = ""
	} else {
		attached, err := strconv.ParseFloat(value, 64)
		if err != nil {
			return err
		}
		i.AttachedTo = strconv.FormatFloat(attached, 'f', -1, 64)
	}

	value = fmt.Sprintf("%v", fields["subnet_size"])
	if len(value) == 0 || value == "<nil>" {
		value = "0"
	}
	size, err := strconv.ParseInt(value, 10, 64)
	if err != nil {
		return err
	}
	i.SubnetSize = int(size)

	i.IPType = fmt.Sprintf("%v", fields["ip_type"])
	i.Subnet = fmt.Sprintf("%v", fields["subnet"])
	i.Label = fmt.Sprintf("%v", fields["label"])

	return
}
358522
func (p *postIndexRequest) UnmarshalJSON(b []byte) error {

	// m is an overflow map used to capture additional, unexpected keys.
	m := make(map[string]interface{})
	if err := json.Unmarshal(b, &m); err != nil {
		return errors.Wrap(err, "unmarshalling unexpected values")
	}

	validIndexOptions := getValidOptions(pilosa.IndexOptions{})
	err := validateOptions(m, validIndexOptions)
	if err != nil {
		return err
	}
	// Unmarshal expected values.
	_p := _postIndexRequest{
		Options: pilosa.IndexOptions{
			Keys:           false,
			TrackExistence: true,
		},
	}
	if err := json.Unmarshal(b, &_p); err != nil {
		return errors.Wrap(err, "unmarshalling expected values")
	}

	p.Options = _p.Options

	return nil
}
1227914
func (s *PrefetchStatus) UnmarshalJSON(b []byte) error {
	var st string
	if err := json.Unmarshal(b, &st); err != nil {
		return err
	}
	switch st {
	default:
		return ErrUnrecognizedPrefetchStatus
	case "NoPrefetch":
		*s = NoPrefetch
	case "TriggeredPrefetch":
		*s = TriggeredPrefetch
	case "FinishedPrefetch":
		*s = FinishedPrefetch
	}
	return nil
}