It seems to be using cheshire under the covers, did you add an encoder for your class? e.g:
(add-encoder java.awt.Color (fn [c jsonGenerator] (.writeString jsonGenerator (str c)))) On Thu, Oct 4, 2012 at 12:04 PM, arekanderu <arekand...@gmail.com> wrote: > Hello, > > I am not sure if i am supposed to ask a noir-related question in the group > but the noir issues at github is closed so i thought someone here might > know. I am trying to use a custom encoder with noir.response but i am > failing to understand how. > > This is what I am trying to do which at the moment fails of course: > >>> (ns my-app.views.my-page >>> >>> (:require [noir.response :as resp])) >>> >>> >>> (defpage "/my-page" [] >>> >>> (let [java-object (do-something)] >>> >>> (resp/json java-object))) > > > The error message > >> Cannot JSON encode object of class: class-name-here - (class >> org.codehaus.jackson.JsonGenerationException) > > > It does work however if i use gson on my java-object before i pass it to > resp/json but i prefer to do it without gson. I am pretty sure its possible > :) > > Thank you for any replies > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en