MCPcopy
hub / github.com/tidwall/gjson / Float

Method Float

gjson.go:177–189  ·  view source on GitHub ↗

Float returns an float64 representation.

()

Source from the content-addressed store, hash-verified

175
176// Float returns an float64 representation.
177func (t Result) Float() float64 {
178 switch t.Type {
179 default:
180 return 0
181 case True:
182 return 1
183 case String:
184 n, _ := strconv.ParseFloat(t.Str, 64)
185 return n
186 case Number:
187 return t.Num
188 }
189}
190
191// Time returns a time.Time representation.
192func (t Result) Time() time.Time {

Callers 4

TestParseAnyFunction · 0.80
TestPlus53BitIntsFunction · 0.80
TestTypesFunction · 0.80
TestNaNInfFunction · 0.80

Calls

no outgoing calls

Tested by 4

TestParseAnyFunction · 0.64
TestPlus53BitIntsFunction · 0.64
TestTypesFunction · 0.64
TestNaNInfFunction · 0.64