Clojurians-log, the publicly searchable archive of this Slack community, now renders emoji reactions. With thanks to @mitesh who did the bulk of the work on this. e.g. https://clojurians-log.clojureverse.org/announcements/2020-12-22
Thanks, this was super fun to work on and definitely a team effort! 🦜 If anyone has some cool ideas of what we can do with the logs feel free to create an issue: https://github.com/clojureverse/clojurians-log-app/issues ^_^
[metosin/jsonista "0.3.0"]
is out. Jsonista fast JSON decoding & encoding library for Clojure built directly on top of Jackson Databind.
• updated to use latest Jackson version, 0.12.0
• BREAKING: Joda-classes are not support by default, register com.fasterxml.jackson.datatype.joda/JodaModule
to add support - or use java.time
classes instead.
• new jsonista.tagged
ns for building Transit-style tagged JSON value representations. Users have reported up to 10x better encoding throughput compared to vanilla Transit.
• Jsonista just hit 1M downloads on clojars 🎉
Github: https://github.com/metosin/jsonista
Big thanks to all contributors.
@delaguardo good point about the keywords. Just merged in https://github.com/metosin/jsonista/pull/40, didn’t check if that resolves the issue
@karol.wojcik cljs not planned, but interesting idea. Interested in developing the cljs-client? could be just a new ns?
@ikitommi One of the attractive properties of transit is that it is cross-language, not just clj <-> clj. So when using tags in clj, it would be nice to be able to decode this in Go or Ruby, or whatnot. Btw, this is a real problem, not just one I made up.
@borkdude I think there could be encoders & decoders for all common types. Also, need to handle keys too, the current impl just handles values.
are there any cross-language tagging conventions out there? (besided transit, which hasn’t gained much traction outside of clojure, I believe)
but I guess in Go you could look at your own made up tags and do the custom serialization. Good question. I think JSON schema has something around content types
Would love to, but certainly not in this year. To much consumed by studies and work ;( Anyway if this implementation could be faster than transit a lot of companies could benefit from it. Especially when doing SPA SSR.
btw, the tagged-json is faster than nippy in the simple benchmarks. which sounds fishy.
https://json-schema.org/understanding-json-schema/reference/non_json_data.html
If performance is the goal, one option is to help make the current Transit faster.
great discussion, will start a Clojureverse thread out of this.
I've had this problem for a while https://github.com/cognitect/transit-clj/issues/43 which may be low hanging fruit to speed up transit
This is due to too many flushes
https://github.com/metosin/jsonista/pull/41 here is a PR to handle keyword format suggested by me
Can this be used to build a new transit server? Then you can use the transit cljs client?
https://clojureverse.org/t/tagged-json-with-jsonista-vs-transit/6946
honestly, haven't checked the transit internals for a while. Might be able to do a transit server, but would need to read the spec/source.
transit also does caching of symbols and values which compresses the payload. this is relevant for network traffic, but it may be less good for performance. so it's good take make explicit what you are optimizing for
https://github.com/cognitect/transit-format#recursive-tag-based-encoding there are two formats missing in jsonista: • string-based encoding • object-based encoding
I think transit might have ability to represent recursive data structures, which JSON lacks?
guide for the tagged json here: https://github.com/metosin/jsonista#tagged-json
Thanks for pouring the json 🍻
Will tagged json get support on cljs side?
(-> (keyword "x/z" "y") (j/write-value-as-string mapper) (doto prn) (j/read-value mapper) ((juxt namespace name)))
"[\"!kw\",\"x/z/y\"]"
["x" "z/y"]
using single argument for tagged form of keyword (and symbol as well) could cause problems for keywords slightly violating clojure’s reading rules
I would like to suggest this form ["!kw",["namespace","name"]]
for namespaced and ["!kw",["name"]]
for simple keywords. I did something similar in one of my projects and nether regretted it.awesome lib btw! I already scheduled some time for “cheshire->jsonista” type of refactoring
Would it make sense to come up with a default scheme that would allow you to serialize EDN via jsonista as an alternative to transit, for full compatibility? Support for sets, uuids, bytes, ...
definitely make sense to me, I will need it anyway
transonista