Git Product home page Git Product logo

Comments (14)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
One feature of JSON.simple is to be compatible with JDK1.2 and later (both 
source
level and binary level, so it supports almost all of JDKs if not all), thus
JSON.simple doesn't use generic feature from JDK1.5 directly, but it does 
support all
of Map and List implementations with
JSONValue.toJSONString()/JSONValue.writeJSONString(). 

As a result, if an application/library can not use JSON.simple, it may be a 
build or
configuration issue of that application/library.

Thanks. 

Original comment by [email protected] on 16 Dec 2009 at 8:41

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
I followed the link you provided, maybe you can type something like to make it 
work:

scala> o.put("a",new Integer(1))

Original comment by [email protected] on 16 Dec 2009 at 1:22

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Unfortunately no:

scala> obj.put("a",new Integer(1))
<console>:8: error: overloaded method value put with alternatives (K,V)V <and> 
((K
with K,_20)_20) forSome { type _20 >: V with V } cannot be applied to
(java.lang.String,java.lang.Integer)
       obj.put("a",new Integer(1))

Original comment by [email protected] on 16 Dec 2009 at 1:32

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
The following should work:

scala> val o = new java.util.HashMap[String, Int]()
o: java.util.HashMap[String,Int] = {}

scala> o.put("a",1)
res5: Int = 0

scala> org.json.simple.JSONValue.toJSONString(o)
res6: java.lang.String = {"a":1}


Original comment by [email protected] on 16 Dec 2009 at 3:51

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Thanks a lot for the tip !

Original comment by [email protected] on 16 Dec 2009 at 5:47

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Is there any merit to releasing version 2.0 of this library to support language
improvements like generics and strongly typed collections?

Since JDK 1.4 is now reaching end of life, these types of updates would be 
really
useful for EE applications built on Java EE 5 where Javascript and Java are
responsible for data exchange.

Original comment by [email protected] on 5 Mar 2010 at 6:14

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Thank you Owen for your suggestion, I'll re-consider supporting of JDK2. The 
initial
intention is to make it compatible with ALL version of JDK as well as J2ME.

Original comment by [email protected] on 8 Mar 2010 at 5:52

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024

Original comment by [email protected] on 29 Nov 2011 at 3:26

  • Changed state: Accepted
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
My two cents in favour of migrating to generics: compiling a java project 
(which uses json-simple) with javac's -Xlint option results into dozens of 
"[unchecked]" warnings. Thanks.

Original comment by [email protected] on 4 Dec 2012 at 3:09

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Until the library is updated to support generics this could be a case where 
@SuppressWarnings("unchecked") makes sense.

Original comment by [email protected] on 2 May 2013 at 6:48

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Another vote to leave ancient history behind and use generics.

Original comment by [email protected] on 1 Jul 2013 at 10:52

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Please, stop supporting old version of Java and start supporting generics!

Original comment by [email protected] on 17 Oct 2013 at 2:32

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
One more vote for supporting generics; trying to iterate over the object in an 
idiomatic way like so:

   for (Map.Entry entry : jsonObject.entrySet()) { /* ... */ }

will lead to compile errors, because the compiler is seeing a Set of Objects 
instead of a set to Map.Entry instances.
Looking at 
http://zeroturnaround.com/rebellabs/java-tools-and-technologies-landscape-for-20
14/ slide 6: only 2% are still on Java 5, Java4 is not even mentioned anymore.

Original comment by [email protected] on 6 Jun 2014 at 10:22

from json-simple.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
I have a best solution. Instead of this lib, use Gson.
Gson has generics and you need not try to catch an exception on every single 
interface method invocation.

Original comment by [email protected] on 6 Jun 2014 at 1:13

from json-simple.

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.