Giter Site home page Giter Site logo

Allow custom decoder function about cheshire HOT 2 CLOSED

laczoka avatar laczoka commented on August 19, 2024
Allow custom decoder function

from cheshire.

Comments (2)

dakrone avatar dakrone commented on August 19, 2024

Hi @laczoka,

Unfortunately, I think this feature is outside the scope of cheshire, and would require architectural changes that would impact the performance-oriented nature. The json encoding/decoding library shouldn't handle coercing data.

from cheshire.

jzwolak avatar jzwolak commented on August 19, 2024

I might agree with @dakrone , except that Chesire converts Clojure keywords to strings when creating JSON and then leaves them as strings when converting back to Clojure data structures. This is problematic as the encode and decode are not reverse operations of each other. Most users will assume they are. The problem, of course, is that JSON doesn't have an equivalent of Clojure's keyword type, so data is lost when converting to JSON. Providing the user with a way to handle this as part of the encode/decode fns would allow the user to make them the reverse operations for the user's data. Write the data to a web app backend... read it later... and something else comes out because of this.

So basically, Chesire makes a decision about type conversion that limits what data can be conveniently used and provides no mechanism for choosing otherwise. Yet, the key-fn is provided for the keys. I don't know... I think it's worth doing this.

from cheshire.

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.