← Latest products

Go-testdeep

testing JSON content in Golang. func JSON(expectedJSON any, params ...any) TestDeep JSON operator allows to compare the JSON representation of data against expectedJSON. expectedJSON can be a: string containing JSON data like {"fullname":"Bob","age":42} string containing a JSON filename, ending with “.json” (its content is os.ReadFile before unmarshaling) []byte containing JSON data encoding/json.RawMessage containing JSON data io.Reader stream containing JSON data (is io.ReadAll before unmarshaling) expectedJSON JSON value can contain placeholders. The params are for any placeholder parameters in expectedJSON. params can contain TestDeep operators as well as raw values. A placeholder can be numeric like $2 or named like $name and always references an item in params. params can also contains [encoding/json/v2.Options] when [encoding/json/v2] must be used, see jsonv2 example. The last release of go-testdeep brings a lot of new features, including some JSON enhancements making it probably one of the best solutions to do JSON comparisons in golang world.

Visit go-testdeep.zetta.rocksexternal site

Reactions (1)

Similar products

by description similarity

  1. First time ever working on something like this, check it out

    Hacker News22 pts

  2. JSON-qs

    github.com

    JSON in query strings, human-readable, compact

    Hacker News13 pts

  3. ~99% page skip and sub-ms lookups

    Hacker News15 pts

  4. Duper

    duper.dev.br

    The Format That's Super

    Hacker News31 pts

  5. Jsonic

    medium.com

    Python JSON serialization that works

    Hacker News24 pts