Skip to content

NewJson should fail, but it does not #91

@ling-zhou

Description

@ling-zhou

import (
        "fmt"
        sjson "github.com/bitly/go-simplejson"
)

func main() {
        body := `"{"client_id":"abc123","client_ip":"59.37.125.15","client_version":"1"}"`
        // body := `{"client_id":"abc123","client_ip":"59.37.125.15","client_version":"1"}`

        js, err := sjson.NewJson([]byte(body))
        if err != nil {
                fmt.Printf("failed to decode json(%s): %v", body, err) // should fail, but it does not!
                return
        }

        fmt.Printf("js: (%v)\n", js)
        return
}

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