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

putting a Date into a JSONObject #3

Closed
GoogleCodeExporter opened this issue May 11, 2015 · 4 comments
Closed

putting a Date into a JSONObject #3

GoogleCodeExporter opened this issue May 11, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. putting a Date-object into a JSONObject

What is the expected output? What do you see instead?
I expected a String representation of that Date, but I get it without
quotes, so the JSON is not valid.


What version of the product are you using? On what operating system?
version 1.1 of json-simple


To fix it, I have to "convert" the date by toString().

Original issue reported on code.google.com by dief...@gmail.com on 20 Apr 2009 at 1:33

@GoogleCodeExporter
Copy link
Author

Here's the mapping between JSON and Java entities:
http://code.google.com/p/json-simple/wiki/MappingBetweenJSONAndJavaEntities

Basically, you need to follow the mapping to get valid JSON strings.

Original comment by fangyid...@gmail.com on 20 Apr 2009 at 1:45

@GoogleCodeExporter
Copy link
Author

Original comment by fangyid...@gmail.com on 21 Apr 2009 at 4:51

  • Changed state: Invalid

@GoogleCodeExporter
Copy link
Author

I disagree with the current behaviour. The library should either automatically 
quote
what toString() returns or not accept unrecognized objects at all. Silently 
producing
broken JSON is the worst option of all IMHO.

Original comment by martin.p...@gmail.com on 10 Aug 2009 at 1:34

@GoogleCodeExporter
Copy link
Author

writeJSONString(Object) writing an unquoted toString() is a disaster.  I agree 
with martin, silently producing broken JSON is the worst option, and the 
default behavior.

Original comment by ober...@civicscience.com on 4 Mar 2014 at 6:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant