Giter Site home page Giter Site logo

custom encoder problem about cheshire HOT 9 CLOSED

boxxxie avatar boxxxie commented on August 19, 2024
custom encoder problem

from cheshire.

Comments (9)

dakrone avatar dakrone commented on August 19, 2024

@boxxxie what version of Cheshire are you using? I'm able to run your exact example from the REPL with no problem:

∴ lein repl
nREPL server started on port 58700
REPL-y 0.1.10
Clojure 1.5.1
    Exit: Control+D or (exit) or (quit)
Commands: (user/help)
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
          (user/sourcery function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
          (user/clojuredocs name-here)
          (user/clojuredocs "ns-here" "name-here")
user=> (ns my-namespace
  #_=>   (:require
  #_=>             ;;cheshire stuff
  #_=>             [cheshire.core :refer :all]
  #_=>             [cheshire.generate :refer [add-encoder encode-str remove-encoder]]))
nil
my-namespace=> (add-encoder java.net.URI encode-str)
nil
my-namespace=> (encode (java.net.URI. "/foo"))
"\"/foo\""

from cheshire.

boxxxie avatar boxxxie commented on August 19, 2024

maybe wrap-json-response is what i should look at, then.

from cheshire.

dakrone avatar dakrone commented on August 19, 2024

What versions of clj-http and cheshire are you using? There was an issue with Cheshire 5.1.0 that was fixed in 5.1.1 that might be causing this.

from cheshire.

boxxxie avatar boxxxie commented on August 19, 2024

[cheshire "5.0.2"]

from cheshire.

boxxxie avatar boxxxie commented on August 19, 2024

with 5.1.1 i have the same problem

from cheshire.

dakrone avatar dakrone commented on August 19, 2024

@boxxxie do you have an example of what you're trying to encode that causes this exception? From your wrap-json-response comment, I assume you're using clj-http? What version of clj-http are you using?

from cheshire.

boxxxie avatar boxxxie commented on August 19, 2024

actually, i'm using ring-json, and it uses 5.0.2

i'm encoding a datomic URI entity type.

from cheshire.

dakrone avatar dakrone commented on August 19, 2024

Can you give me an example response that ring-json is trying and failing to encode? I'm currently unable to reproduce this locally.

from cheshire.

boxxxie avatar boxxxie commented on August 19, 2024

actually i was wrong. ring-json may be ok (though it's using an older version of cheshire, so i brought it down as part of my project).

liberator is using something other than cheshire. i changed that and now things are working.

from cheshire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.