func Reconstruct(input []byte) ([]byte, error) {
	b := make([]byte, 0, len(input))
	err := Walk(input, func(st int, key, value []byte) bool {
		if len(b) != 0 && ShouldAddComma(value, b[len(b)-1]) {
			b = append(b, ',')
		}
		if len(key) > 0 {
			b = append(b, key...)
			b = append(b, ':')
		}
		b = append(b, value...)
		return true
	})
	return b, err
}
Reconstruct walks through the input json and rebuild it. It's put here as an
example of using Walk.
package ujson
import "fmt"
func Walk(input []byte, callback func(level int, key, value []byte) bool) error {
	var key []byte
	i, si, ei, st, sst := 0, 0, 0, 0, 1024
	if len(input) > 0 && input[len(input)-1] == '\n' {
		input = input[:len(input)-1]
	}
value:
	si = i
	switch input[i] {
	case 'n', 't':  
		i += 4
		ei = i
		if st <= sst {
			callback(st, key, input[si:i])
		}
		key = nil
		goto closing
	case 'f':  
		i += 5
		ei = i
		if st <= sst {
			callback(st, key, input[si:i])
		}
		key = nil
		goto closing
	case '{', '[':
		if st <= sst && !callback(st, key, input[i:i+1]) {
			sst = st
		}
		key = nil
		st++
		i++
		if input[i] == '}' || input[i] == ']' {
			goto closing
		}
		goto value
	case '"':  
		for {
			i++
			switch input[i] {
			case '\\':  
				i++
			case '"':  
				i++
				ei = i  
				for input[i] == ' ' ||
					input[i] == '\t' ||
					input[i] == '\n' ||
					input[i] == '\r' {
					i++
				}
				if input[i] != ':' {
					if st <= sst {
						callback(st, key, input[si:ei])
					}
					key = nil
				}
				goto closing
			}
		}
	case ' ', '\t', '\n', '\r':  
		i++
		goto value
	default:  
		for i < len(input) {
			switch input[i] {
			case ',', '}', ']', ' ', '\t', '\n', '\r':
				ei = i
				for input[i] == ' ' ||
					input[i] == '\t' ||
					input[i] == '\n' ||
					input[i] == '\r' {
					i++
				}
				if st <= sst {
					callback(st, key, input[si:ei])
				}
				key = nil
				goto closing
			}
			i++
		}
	}
closing:
	if i >= len(input) {
		return nil
	}
	switch input[i] {
	case ':':
		key = input[si:ei]
		i++
		goto value
	case ',':
		i++
		goto value
	case ']', '}':
		st--
		if st == sst {
			sst = 1024
		} else if st < sst {
			callback(st, nil, input[i:i+1])
		}
		if st <= 0 {
			return nil
		}
		i++
		goto closing
	case ' ', '\t', '\n', '\r':
		i++  
		goto closing
	default:
		return parseError(i, input[i], `expect ']', '}' or ','`)
	}
}
func parseError(i int, c byte, msg string) error {
	return fmt.Errorf("µjson: error at %v '%c' 0x%2x: %v", i, c, c, msg)
}
func ShouldAddComma(value []byte, lastChar byte) bool {
	return value[0] != '}' && value[0] != ']' &&
		lastChar != ',' && lastChar != '{' && lastChar != '['
}