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.
It'd be great to have access to an annotation type "meta" or some other way to easily access the Meta information from a JSON API document.
Currently I'm unmarshaling twice: once into OnePayload via encoding/json and again via the jsonapi unmarshal methods. It'd be wonderful to button this up.
The point of meta is to describe the response.. What's the point of submitting a request with meta to your api? If its a required field, it should be in attributes or another object? Not disagreeing, just wondering what the use-case is?
My use case is actually for a response, I'd like to extract that meta result. Currently I'm unmarshaling twice to get it since the tags don't support getting it directly.
On Tue, Apr 11, 2017 at 6:43 PM Mitchell Hashimoto ***@***.***> wrote:
My use case is actually for a response, I'd like to extract that meta
result. Currently I'm unmarshaling twice to get it since the tags don't
support getting it directly.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#82 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAADMA7wKz3DMiFBcPdOqS7W4jBEphjhks5rvAIJgaJpZM4MN9r_>
.
Hi there. Is there any update on this issue or the related #95 ?
My use-case requires creating a go JSON API server and client, meaning I will need to marshal and unmarshal the data. More specifically, I would like access to the "meta" for a relationship, which seems to be already supported for marshalling (see https://github.com/google/jsonapi/blob/master/node.go#L59).
My current options seem to be:
Unmarshal twice, as @mitchellh has done. I believe that this would require a little work to map the data to the appropriate relationship.
Unmarshal exclusively using encoding/json.
If anyone has any other potential workarounds, I'd be extremely grateful!
Reacted by Rob Lowcock, Edison Spencer, Ben Kraus, Guntur Akhmad and jgermond
func setDataIntoTarget(data *Data, target interface{}) error {} is missing following chunk of code which will resolve meta part of unmarshaling
if data.Meta != nil {
err = json.Unmarshal(data.Meta, castedTarget)
if err != nil {
return err
}
}
Activity
svperfecta commentedon Apr 11, 2017
The point of meta is to describe the response.. What's the point of submitting a request with meta to your api? If its a required field, it should be in attributes or another object? Not disagreeing, just wondering what the use-case is?
mitchellh commentedon Apr 11, 2017
My use case is actually for a response, I'd like to extract that meta result. Currently I'm unmarshaling twice to get it since the tags don't support getting it directly.
svperfecta commentedon Apr 12, 2017
tscott0 commentedon Nov 21, 2018
Hi there. Is there any update on this issue or the related #95 ?
My use-case requires creating a go JSON API server and client, meaning I will need to marshal and unmarshal the data. More specifically, I would like access to the "meta" for a relationship, which seems to be already supported for marshalling (see https://github.com/google/jsonapi/blob/master/node.go#L59).
My current options seem to be:
encoding/json.If anyone has any other potential workarounds, I'd be extremely grateful!
nikhilatshaw commentedon Dec 29, 2020
func setDataIntoTarget(data *Data, target interface{}) error {} is missing following chunk of code which will resolve meta part of unmarshaling
if data.Meta != nil {
err = json.Unmarshal(data.Meta, castedTarget)
if err != nil {
return err
}
}