GithubHelp home page GithubHelp logo

Comments (8)

sescobb27 avatar sescobb27 commented on May 10, 2024

screen shot 2015-10-21 at 3 39 40 pm

from jsonapi-serializer.

sarus avatar sarus commented on May 10, 2024

Seems like it would be a neat addition to be able to go both ways. Is the idea here to take a json api payload and turn it back into the original denormalized input data?

I assume the use case here is in the browser if you're not using something like Ember Data?

from jsonapi-serializer.

sescobb27 avatar sescobb27 commented on May 10, 2024

yeah, I made this PR #43, the idea is to deserialize the payload into plain JS objects from a Req/Res payload body

from jsonapi-serializer.

SeyZ avatar SeyZ commented on May 10, 2024

Hey @sescobb27, thanks for your idea!

jsonapi-serializer aims to be totally framework agnostic, and I'm not sure the deserialization stuff can be agnostic. When you deserialize a relationship (e.g. a Plan), you expect to have a Plan object (Mongoose model, sequelize model or whatever).

from jsonapi-serializer.

sescobb27 avatar sescobb27 commented on May 10, 2024

Yeah you are right but at this moment we can return a plain JS Object and let the user handle framework's specific logic, for example, I'm using the fork I made and it works pretty well, the only thing I run after DeSerialize is a normalization step to handle relationships. why? because it should be agnostic but I want to DRY my code as much as I can in order to reuse serialization/deserialization stuff and is easier, at least for me, to adapt a plain nested JS object than a JSON API payload

from jsonapi-serializer.

sescobb27 avatar sescobb27 commented on May 10, 2024

https://gist.github.com/sescobb27/ce0bbe86db395f1464cc

from jsonapi-serializer.

SeyZ avatar SeyZ commented on May 10, 2024

Awesome @sescobb27 Thanks for the hard work!

I have an application that uses jsonapi-serializer. For now, I handle the deserialization without this library, by hand. It's a good idea to improve that!

I'll use your branch in my project and I'll give you my feedback.
Thanks again!

from jsonapi-serializer.

SeyZ avatar SeyZ commented on May 10, 2024

The deserializer part is now on master. Documentation will be available soon. Meanwhile, check the tests ;-)

from jsonapi-serializer.

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.