You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 4, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 4, 2025. It is now read-only.
I am trying to unmarshal a JSON API response which contains attributes that are objects. I tried marshaling and the result JSON is correct but when I try to unmarshal that same JSON it fails with data is not a jsonapi representation of '*main.Profile'. Here is some example code:
Is work on this still progressing? My case is similar but here is my code:
type Profile struct {
ID string json:"id" jsonapi:"primary,profiles"
AvatarList []Avatar json:"avatar" jsonapi:"attr,avatar"
}
type Avatar struct {
Large string json:"large"
Small string json:"small"
}
I tried this with the current embeded-structs branch and it didn't work. Any status on this would be appreciated. The marshal function returned what I expected but the unmarshal returned an error ("data is not a jsonapi representation of '*jsonapi.Profile").
Activity
gopherfortress commentedon Feb 26, 2017
Any news about this issue? Thanks.
aren55555 commentedon Aug 1, 2017
We have been actively working on this feature in the branch https://github.com/google/jsonapi/tree/feature/embeded-structs
wayne-brush-kw commentedon Apr 13, 2018
Is work on this still progressing? My case is similar but here is my code:
type Profile struct {
ID string
json:"id" jsonapi:"primary,profiles"AvatarList []Avatar
json:"avatar" jsonapi:"attr,avatar"}
type Avatar struct {
Large string
json:"large"Small string
json:"small"}
I tried this with the current embeded-structs branch and it didn't work. Any status on this would be appreciated. The marshal function returned what I expected but the unmarshal returned an error ("data is not a jsonapi representation of '*jsonapi.Profile").
mlitanin commentedon Jun 22, 2018
same issue here. Can't unmarshal the json to the struct with attributes that a objects.... Can't even find any workaround.
redmamoth commentedon Nov 9, 2022
any update on this issue?
It seems we can't use arrays of simple types inside attributes either: https://go.dev/play/p/3qufy0gFk3u
Update Run Tasks for global config and stages
Update Run Tasks for global config and stages
Update Run Tasks for global config and stages
Update Run Tasks for global config and stages
Update Run Tasks for global config and stages
Update Run Tasks for global config and stages
Update Run Tasks for global config and stages
Update Run Tasks for global config and stages