kallax relation display full json object
maheshjadav opened this issue · 1 comments
HI
in kallax with method it's display full json object like below
[{"ID":5,"Status":2,"Branch":1,"Name":"Smslane","Created_at":"2018-05-08T10:47:12Z","Created_by":1,"Updated_at":"2018-05-11T04:58:42Z","Updated_by":13,"Statusname":{"ID":2,"Active":1,"Updated_by":1,"Name":"inactive","Updated_at":"2018-04-23T09:53:09Z"},"Createdby":null}]}
can seen Statusname it is displaying full json object
but i want only Name key value "inactive" in Statuname
so it will became like this "Statusname":"inactive"
how i can do that
You can either implement your own MarshalJSON
funcition, or adding a dummy Statusname string
property and initialize it using hooks, and tag the current Statusname
(the full object) with json:"-"
.