Comments (9)
Further investigation has lead to a simpler case where encoding fails to encode correctly.
(custom/encode '('one 'two)) -> "[["/","/"],["/","/"]]"
as the json encoded string. I suspect symbol handling somewhere is the issue.
from cheshire.
Yea, I suspect the symbol handling is also to blame. I'll take a look at this.
from cheshire.
I think I know the issue after looking at the code.
The code assumes that the symbol will have been interned. In my case that
is not true, so resolve returns nil.
I think testing for symbol internment will be what is needed to resolve the
issue.
(William Hidden) https://sites.google.com/site/hiddenhome/
On Wed, Jan 11, 2012 at 12:52 PM, Lee <
[email protected]
wrote:
Yea, I suspect the symbol handling is also to blame. I'll take a look at
this.
Reply to this email directly or view it on GitHub:
#13 (comment)
from cheshire.
Lee,
Here's how I patched encode-symbol to get what I needed. Not sure if it
complies with what you were looking for:
diff --git a/src/cheshire/custom.clj b/src/cheshire/custom.clj
index 399ca63..cccbad7 100644
--- a/src/cheshire/custom.clj
+++ b/src/cheshire/custom.clj
@@ -126,9 +126,11 @@
"Encode a clojure symbol to the json generator. Symbols will be encoded
as
/"
[^clojure.lang.Symbol s ^JsonGenerator jg]
- (.writeString jg (str (:ns (meta (resolve s)))
-
"/"
-
(:name (meta (resolve s))))))
- (if (resolve s)
- (.writeString jg (str (:ns (meta (resolve s)))
-
"/"
-
(:name (meta (resolve s)))))
- (.writeString jg (name s))))
;; extended implementations for clojure datastructures
(extend nil
(William Hidden) https://sites.google.com/site/hiddenhome/
On Wed, Jan 11, 2012 at 2:16 PM, William Hidden [email protected]:
I think I know the issue after looking at the code.
The code assumes that the symbol will have been interned. In my case that
is not true, so resolve returns nil.I think testing for symbol internment will be what is needed to resolve
the issue.(William Hidden) https://sites.google.com/site/hiddenhome/
On Wed, Jan 11, 2012 at 12:52 PM, Lee <
[email protected]wrote:
Yea, I suspect the symbol handling is also to blame. I'll take a look at
this.
Reply to this email directly or view it on GitHub:
#13 (comment)
from cheshire.
I just pushed a fix for this in eaee529, can you give it a shot and see if it works for all your use cases?
from cheshire.
Yes... works for me, thanks.
(William Hidden) https://sites.google.com/site/hiddenhome/
On Wed, Jan 11, 2012 at 6:21 PM, Lee <
[email protected]
wrote:
I just pushed a fix for this in eaee529, can you give it a shot and see if
it works for all your use cases?
Reply to this email directly or view it on GitHub:
#13 (comment)
from cheshire.
Cool, I'll push a new version out with this fix.
from cheshire.
Fixed in 2.0.5
from cheshire.
Thank you for putting together the Cheshire library it is exactly what I
needed!
(William Hidden) https://sites.google.com/site/hiddenhome/
On Wed, Jan 11, 2012 at 6:34 PM, Lee <
[email protected]
wrote:
Fixed in 2.0.5
Reply to this email directly or view it on GitHub:
#13 (comment)
from cheshire.
Related Issues (20)
- Always update to latest version of Jackson, when available
- Any way to not escape the quotes HOT 2
- Suggestion: prove equivalence with clojure.data.json HOT 6
- Add support for capturing source position/locations when parsing HOT 2
- Allow key-fn like hook for value HOT 2
- Converting nested fields from java objects to clojure types doesnot work
- Custom conversion when parsing?
- `parsed-smile-seq` actually parses JSON
- Run tests against JSONTestSuite
- Resulting Array from parse not processed lazily HOT 1
- :key-fn no longer works in generate-string? HOT 1
- Using the Ubuntu Cheshire package with Clojure HOT 1
- lein unable to find cheshire on classpath HOT 1
- Security vulnerability in Jackson dependency HOT 4
- Can't convert object of type org.postgresql.util.PGobject HOT 1
- support jackson's fast number parsing/writing features HOT 1
- Update test.generative HOT 2
- Possible to support parsing copy-paste JSON? HOT 1
- Test failures with Java 21
- Deterministic parse and generate HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cheshire.