Git Product home page Git Product logo

Comments (5)

tscott0 avatar tscott0 commented on May 4, 2024 5

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:

  1. Unmarshal twice, as @mitchellh has done. I believe that this would require a little work to map the data to the appropriate relationship.
  2. Unmarshal exclusively using encoding/json.

If anyone has any other potential workarounds, I'd be extremely grateful!

from jsonapi.

mitchellh avatar mitchellh commented on May 4, 2024 1

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.

from jsonapi.

svperfecta avatar svperfecta commented on May 4, 2024

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?

from jsonapi.

svperfecta avatar svperfecta commented on May 4, 2024

from jsonapi.

nikhilatshaw avatar nikhilatshaw commented on May 4, 2024

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
}
}

from jsonapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.