We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I've a requirement where I can decode only keys.
consider the below example -
(require '[jsonista.core :as json]) (import (com.fasterxml.jackson.core JsonFactory$Feature) (com.fasterxml.jackson.databind ObjectMapper) (com.fasterxml.jackson.datatype.joda JodaModule)) (def s "{\"name\":\"person1\",\"book\":\"Demo Book\",\"hash\":{\"key1\":\"value1\",\"key2\":\"value2\",\"key3\":\"value3\"}}") (def ^ObjectMapper object-mapper (let [obj-mapper (json/object-mapper {:decode-key-fn true :modules [(JodaModule.)]})] (doto obj-mapper (-> .getFactory (.disable JsonFactory$Feature/USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING))) obj-mapper)) (json/read-value s object-mapper)
The output I would like to get is
{:book "Demo Book", :hash {"key3" "value3", "key2" "value2", "key1" "value1"}, "name" "person1"}
In the json above, the top level is converted to keys and nested are not converted to keys but kept as string.
:decode-key-fn true make all keys and without :decode-key-fn true all keys are strings which is not I want. How can I achieve the same?
:decode-key-fn true
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I've a requirement where I can decode only keys.
consider the below example -
The output I would like to get is
In the json above, the top level is converted to keys and nested are not converted to keys but kept as string.
:decode-key-fn true
make all keys and without:decode-key-fn true
all keys are strings which is not I want. How can I achieve the same?The text was updated successfully, but these errors were encountered: