Open GoogleCodeExporter opened 9 years ago
Thank you Karl for your work. I will review it and try to incorporate it in the
official release. Would you agree to release your codes under Apache 2.0
license?
Original comment by fangyid...@gmail.com
on 17 Apr 2012 at 8:54
It's already blessed with ASL2.
Original comment by karl.wet...@gmail.com
on 17 Apr 2012 at 9:00
Sorry Karl, I have been making you waiting for quite a long time.
Original comment by fangyid...@gmail.com
on 4 Jul 2012 at 5:51
No worries. The code will need some cleaning up from debug stuff. Let me know
and I'll do that for you. I don't care so much about the Bean serialization,
mainly because it feels like a huge job to downport it to Java 1.2, but it
would be really cool if the other stuff made it in.
I'm not sure about the reasons for Java 1.2 in json-simple, but since none of
this code taint any of the core code perhaps you don't need to worry about all
of this being JDK7.
Original comment by karl.wet...@gmail.com
on 4 Jul 2012 at 2:39
Also notice this in JSONFormatter.java when you implement BigDecimal:
} else if (Double.class.equals(input.getObjectValue().getClass())) {
output.write(input.getDoubleValue().toString());
} else if (Long.class.equals(input.getObjectValue().getClass())) {
output.write(input.getLongValue().toString());
} else {
throw new RuntimeException("Unsupported class: " + input.getObjectValue().getClass());
}
Original comment by karl.wet...@gmail.com
on 4 Jul 2012 at 2:44
I was cleaning up the code a bit when I noticed something.
JSONStreamReader really just is a clone of JSONParser with the unmarshaling to
JSONObject and JSONArray commented out and replaced by returning events. Thus
any lexer change that affect JSONParser also needs to be updated in
JSONStreamReader.
Perhaps it is a good idea to refactor so the unmarshaling currently in
JSONParser is moved to a visitor or something like that, allowing for sharing
the actual parser only.
Let me know how you feel about it and I'll try to come up with a patch.
Original comment by karl.wet...@gmail.com
on 4 Jul 2012 at 4:09
Attached patch containing cleaned up JSONStreamReader, BufferedJSONStreamReader
and JSONFormatter down ported to Java 1.2, a bit of java docs, and test cases.
Original comment by karl.wet...@gmail.com
on 5 Jul 2012 at 12:18
Attachments:
Forgot to mention, the patch also contains JSONValue#escape(String, Appenable).
Original comment by karl.wet...@gmail.com
on 5 Jul 2012 at 12:21
Original issue reported on code.google.com by
karl.wet...@gmail.com
on 17 Apr 2012 at 5:49