Skip to content

Recommended way to conform JSON to Hashable #1137

@BenShutt

Description

@BenShutt

What did you do?

How would you recommend conforming JSON to Hashable?
My use case looks something like this:

struct MyModel: Equatable, Hashable, Codable {
    var name: String
    var value: Int
    var json: JSON // Not Hashable error
}

What did you expect to happen?

If JSON already conformed to Hashable like it does Codable that would be most desirable.
I could extend JSON to conform to Hashable in my project, but am interested to hear what you recommend.

I understand this is a feature request rather than a bug.

Environment

  • SwiftyJSON: 5.0.1
  • Xcode Version: 14.3.1
  • Swift Version: 5.8.1
  • Swift Package Manager - Swift 5.8.1

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