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.
First of all, thanks for this library. Very helpful.
I believe I'm running into the same problem as @vickyramachandra. I need to unmarshal a timestamp encoded as a string. The situation is virtually identical to the example shown in the Custom types section of the README. However, upon unmarshaling with UnmarshalManyPayload() I receive the error “json: cannot unmarshal string into Go value of type map[string]interface {}.” As far as I can tell the custom un/marshaling implementation is never called; the failure occurs before reaching that stage of unpacking the JSON API contents.
As in there, ^ node.Attributes is always a map[string]interface {}, before it was err = json.Unmarshal(data, model.Interface()) so the type was inferred from the field. Sorry I'm not confident enough with go to be able to submit a pr myself.
EDIT:
Heads up: It seems that that commit is not in sequence with the previous commit in master chronologically and that it comes from a different branch, so previous commit does not have a working implementation of custom fields either. I'm using parent commit 8b7e0bc from March which has custom types working but not nested attrs working, a workaround is to add json:"fieldname" to all the tags of the nested models.
Reacted by Michael Karlesky, PhD, Kunal Shah and Boris Lenzinger
Activity
mkarlesky commentedon Oct 11, 2018
First of all, thanks for this library. Very helpful.
I believe I'm running into the same problem as @vickyramachandra. I need to unmarshal a timestamp encoded as a string. The situation is virtually identical to the example shown in the Custom types section of the README. However, upon unmarshaling with
UnmarshalManyPayload()I receive the error “json: cannot unmarshal string into Go value of type map[string]interface {}.” As far as I can tell the custom un/marshaling implementation is never called; the failure occurs before reaching that stage of unpacking the JSON API contents.botverse commentedon Oct 12, 2018
@shwoodard 's commit 3c8221b seem to have broken it.
As in there, ^
node.Attributesis always amap[string]interface {}, before it waserr = json.Unmarshal(data, model.Interface())so the type was inferred from the field. Sorry I'm not confident enough with go to be able to submit a pr myself.EDIT:
Heads up: It seems that that commit is not in sequence with the previous commit in
masterchronologically and that it comes from a different branch, so previous commit does not have a working implementation of custom fields either. I'm using parent commit 8b7e0bc from March which has custom types working but not nested attrs working, a workaround is to addjson:"fieldname"to all the tags of the nested models.mkarlesky commentedon Oct 12, 2018
Thank you for the excellent investigative work, @botverse. If I must I think I can get by with the March commit until this issue is resolved.
henrmota commentedon Oct 14, 2018
in this pull request #163