8000 is.EqualJSON support · Issue #59 · matryer/is · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
is.EqualJSON support #59
Open
Open
@sanan-fataliyev

Description

@sanan-fataliyev

Hi,

It would be helpful to have a is.EqualJSON(a, b string) function to compare JSON values structurally, ignoring formatting and key order.

Example:

expected := `{"name":"Alice","age":30}`
actual := `{
    "age": 30,
    "name": "Alice"
}`

is.EqualJSON(expected, actual)

Possible implementation idea

Internally, this could unmarshal both inputs into interface{} and then use is.Equal.

If you're open to it, I’d be happy to contribute a PR.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0