ValidBytes returns true if the input is valid json. if !gjson.Valid(json) { return errors.New("invalid json") } value := gjson.Get(json, "name.last") If working with bytes, this method preferred over ValidBytes(string(data))
(json []byte)
| 2760 | // |
| 2761 | // If working with bytes, this method preferred over ValidBytes(string(data)) |
| 2762 | func ValidBytes(json []byte) bool { |
| 2763 | _, ok := validpayload(json, 0) |
| 2764 | return ok |
| 2765 | } |
| 2766 | |
| 2767 | func parseUint(s string) (n uint64, ok bool) { |
| 2768 | var i int |
searching dependent graphs…