Golang encoding/json.Number.String function example

package encoding/json

String returns the literal text of the number.

Golang encoding/json.Number.String function usage example

 func jsonNumberToBool(num json.Number) bool {
  if num.String() == "1" {
 return true
  }
  return false
 }

Reference :

http://golang.org/pkg/encoding/json/#Number.String

Advertisement