/jsont

Go JSON Tokenizer that also emits insignificant tokens (like whitespaces)

Primary LanguageGoApache License 2.0Apache-2.0

jsont

A JSON tokenizer that also emits insignificant tokens like whitespaces.

{ "Hello" : "World" }

Will be split into the following tokens:

|{| |"Hello"| |:| |"World"| |}|

Usage

tokenizer := jsont.NewTokenizer(strings.NewReader(jsonInput))

for tokenizer.Next() {
	token := tokenizer.Token()
	fmt.Println(token.Type)
	fmt.Println(token.Value)
}                                                                                                                                   

if tokenizer.Error() != nil {
	fmt.Println(tokenizer.Error())
}

Disclaimer