Skip to content

Nested structs not being Unmarshaled #49

Closed
@iderdik

Description

@iderdik

Given a struct that contains another struct:

type Address struct {
    City string `jsonapi:"attr,city" json:"city"`
    State string `jsonapi:"attr,state" json:"state"`
}

type AdditionalInfo struct {
    HomeAddress     *Address `jsonapi:"attr,homeaddress" json:"homeaddress"`
        Phone                  *string     `jsonapi:"attr,phone" json:"phone"`
}

When calling UnmarshalPayload with this json:

{
    "homeaddress": {
        "city": "brooklyn",
        "state": "NY"
    },
    "phone": "555-555-5555"
}

I get an error data is not a jsonapi representation of AdditionalInfo. Are nested structs not supported?

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