Skip to content

fuzzy mode decode error #159

Closed
Closed
@cch123

Description

@cch123
package main

import (
	"fmt"

	"github.com/json-iterator/go"
	"github.com/json-iterator/go/extra"
)

var jsonstr = `
{
    "extra_type": 181760,
    "combo_type": 0,
    "trigger_time_ms": 1498800398000,
    "_create_time": "2017-06-16 11:21:39",
    "_msg_type": 41000
}
`

type OrderEventRequestParams struct {
	ExtraType uint64 `json:"extra_type"`
}

func main() {
	extra.RegisterFuzzyDecoders()
	var a OrderEventRequestParams
	err := jsoniter.UnmarshalFromString(jsonstr, &a)
	fmt.Println(err)
	fmt.Printf("%#v\n", a)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions