Standard library / encoding/json

encoding/json.Number.String()

Return the original number literal without parsing or numeric rounding. Expected stdout: '1.20e3\n'.

Formal Syntax & Structure

go syntaxgo
func (n Number) String() string

Return Value

string

Text representation or diagnostic.

Working Example

Example Snippetgo
package main
import (  "encoding/json"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() { fmt.Println(json.Number("1.20e3").String()) }
Go Reference