Giter Club home page Giter Club logo

Comments (9)

wallymathieu avatar wallymathieu commented on May 30, 2024 1

Seems like F# Data us fixing this as well: https://www.nuget.org/packages/FSharp.Data/3.0.0-beta4 :

(Breaking Change) Don't silently convert decimals and floats to integers in JsonProvider.

from fleece.

wallymathieu avatar wallymathieu commented on May 30, 2024

This also causes trouble when trying to do lensing.

from fleece.

wallymathieu avatar wallymathieu commented on May 30, 2024

JNumber s implies that s is JsonPrimitive ...

from fleece.

wallymathieu avatar wallymathieu commented on May 30, 2024

fsprojects/FSharp.Data#1185

from fleece.

gusty avatar gusty commented on May 30, 2024

I think this behavior is not correct at all.
Anyway, I also think this should be corrected in the original library (as FSharp.Data just did).
We should forward this issue to Newtonsoft and System.Json
Also we should note that Fleece is a Json mapper for different libraries, since different libraries have different behavior (there is no agreed standard for Json <-> .NET) it's not up to Fleece to try to fix them.

from fleece.

wallymathieu avatar wallymathieu commented on May 30, 2024

I agree. It only makes sense to align with the libraries. Right now JNumber active pattern has some interesting behavior.

from fleece.

gusty avatar gusty commented on May 30, 2024

I don't know if this is related:

1 |> toJson |> string;;
val it : string = "1"

but

(2,1) |> toJson |> string;;
val it : string = "[
  2.0,
  1.0
]"

from fleece.

wallymathieu avatar wallymathieu commented on May 30, 2024

We also see this kind of behavior: JamesNK/Newtonsoft.Json#1400
So I guess it's a tradeoff what Json parser you use.

from fleece.

wallymathieu avatar wallymathieu commented on May 30, 2024

I've added a PR that documents the behavior. Note that Fsharp.Data works the way you want.

from fleece.

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.