matryer / matryer/is

is.EqualJSON support

Open
#59 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2k
Forks
67
PR merge metrics
No merged PRs in 30d

Description

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:

```go
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!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing is.Equal implementation and related tests in the repository. Use the issue's example and proposed JSON unmarshalling approach as the acceptance criteria: equivalent JSON should compare equal despite formatting or key order, and the test suite should cover this behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.