In fact, on the latest commit, 
response.clj<https://github.com/bitwalker/noir/blob/master/src/noir/response.clj>does
 not seem to use chesire.custom anymore even though this 
commit<https://github.com/bitwalker/noir/commit/6408d7028cae00937588b599b7c3305bb48e32fd>indicates
 otherwise.

On Thursday, October 4, 2012 8:32:25 PM UTC+3, arekanderu wrote:
>
> Hi Gaz
>
> That's exactly the part that I can't figure out. Where exactly am I 
> supposed to do that? Inside the clj where I am going to use noir.response? 
> My apologies if my question seems silly but I am a bit brain-blocked with 
> this.
>
> On Thursday, October 4, 2012 8:26:29 PM UTC+3, Gaz wrote:
>>
>> 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 <areka...@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 clo...@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+u...@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

Reply via email to