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

Fallback serializers? #48

Open
iku000888 opened this issue Mar 23, 2021 · 0 comments
Open

Fallback serializers? #48

iku000888 opened this issue Mar 23, 2021 · 0 comments

Comments

@iku000888
Copy link

Motivation is to not make this blow up and instead maybe serialize it as just the .toString result.

(jsonista.core/write-value-as-string
 {:foo (jsonista.core/object-mapper)})
=> 
2. Unhandled com.fasterxml.jackson.databind.JsonMappingException

I looked at adding a tagged module by naively declaring a handler for java.lang.Object, but it is not feasible as it would be triggered for everything including clojure types. I feel like it would boil down to what jackson databind allows, but just giving this a shot by creating an issue. 🙏

(jsonista.core/write-value-as-string
 {:foo (jsonista.core/object-mapper)}
 (jsonista.core/object-mapper
  {:modules [(jsonista.tagged/module
              {:handlers {java.lang.Object {:tag "java object"
                                            :encode jsonista.tagged/encode-str}}
               })]}
  ))
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