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

Clojure ser/de inconsistency #10

Open
lxl66566 opened this issue Oct 15, 2024 · 0 comments · May be fixed by #7
Open

Clojure ser/de inconsistency #10

lxl66566 opened this issue Oct 15, 2024 · 0 comments · May be fixed by #7

Comments

@lxl66566
Copy link
Collaborator

I tried to use clojure.data.json to ser/de the history and other structures. And I did a test:

(ns myt
  (:require [clojure.data.json :as json]))
(def my-data {:type :invoke, :f :txn, :value [[:w 2 1]], :time 3291485317, :process 0, :index 0})
(println my-data)
(def json-string (json/write-str my-data))
(println json-string)
(def deser-data (json/read-str json-string :key-fn keyword))
(println deser-data)

The result is:

{:type :invoke, :f :txn, :value [[:w 2 1]], :time 3291485317, :process 0, :index 0}
{"type":"invoke","f":"txn","value":[["w",2,1]],"time":3291485317,"process":0,"index":0}
{:type invoke, :f txn, :value [[w 2 1]], :time 3291485317, :process 0, :index 0}

The key type (:) in value was disappeared. In jepsen, there are amount of key type used in structure value, this problem will affect a lot of ser/de case.

A key point is that we need to keep the : in json format string, otherwise the deserializer will not know which type should a string be deser to, key type or string.

@lxl66566 lxl66566 linked a pull request Oct 15, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant