Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decimal as map key incorrectly serializes to int #57

Closed
bbss opened this issue Feb 24, 2021 · 1 comment
Closed

Decimal as map key incorrectly serializes to int #57

bbss opened this issue Feb 24, 2021 · 1 comment

Comments

@bbss
Copy link

bbss commented Feb 24, 2021

(ns example
  (:require [cognitect.transit :as t]))

(defn roundtrip [x]
  (let [w (t/writer :json)
        r (t/reader :json)]
    (js/console.log (t/write w x)) ;; ["^ ","~i1.1",1.1]
    (t/read r (t/write w x))))

(defn failing-decimal-key []
  (let [data  {1.1 1.1}
        data' (roundtrip data) ;;=> {1 1.1}
        ]
    (js/console.log data data')
    (assert (= data data'))))

(defn init [] (failing-decimal-key))

I think this is a bug in transit-js, transit-clj writing will tag the key with ~d

@bbss
Copy link
Author

bbss commented Sep 6, 2022

duplicate of cognitect/transit-js#36

@bbss bbss closed this as completed Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant