Code Monkey home page Code Monkey logo

Comments (3)

rhertzog avatar rhertzog commented on July 22, 2024

I also filed https://code.djangoproject.com/ticket/16850 on the Django side in case Django is improperly using the simplejson interface.

from simplejson.

etrepum avatar etrepum commented on July 22, 2024

It looks like the problem here is that Django expects that decimal objects will get converted to string (by its default method) instead of a JSON number. This change was made for usability reasons in 2.2.0, most people want decimals to get encoded as numbers even though there's a possible loss of precision if decoded on the other end without the right options. This behavior can be turned back off with use_decimal=False on encode. The version embedded in Django also supports this option (default False rather than True), so it would be compatible with whichever version of dump/dumps ends up getting used.

from simplejson.

etrepum avatar etrepum commented on July 22, 2024

I'm going to close this for now, it's technically a feature and not a bug. I would prefer if Django explicitly asked for the behavior they are expecting.

Re-open if the Django folks would rather simplejson be stuck with its 2.2.0 defaults for now, and I'll revert the behavior and release 2.3.0. Not my preference to do this, since having use_decimal=True on encoding by default is what users have expected for a long time.

from simplejson.

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.