I'm reading about the Java API for Json Processing, specified in ths site. However, when I try to test such code like:
JsonReader reader = Json.createReader(new FileInputStream(...));
I can't, cause neither JsonReader
class or Json
class can't be imported from nowhere. I only get some JsonParser
class which is imported from sun.org.mozilla.javascript.internal.json.JsonParser
but obviously it isn't what I'm trying to get.
I have Java EE installed and I'm working with the Java EE version of Netbeans. How can I seize these features?
Here is the download page for the reference implementation jar of JSR-000353
https://java.net/projects/jsonp/downloads/directory/ri
If you are using JSON I recommend the Jackson JSON library.
http://wiki.fasterxml.com/JacksonHome
The jar files can be found here:
http://wiki.fasterxml.com/JacksonDownload
For further information on the difference in implementations please see this question Differentiating the Jersey, Jackson, and JaxB APIs
JSR 353 was released along with the Java EE 7 platform. JsonObject and JsonReader API can be used in two different ways:
Use a Java EE 7 compliant application server, such as GlassFish 4 . In this case, the API is built in to the runtime and will be resolved correctly for you. You can use NetBeans, Eclipse or IntelliJ and if the server runtime is configured properly then it just works.
Alternatively, you can download the Reference Implementation from http://jcp.org/aboutJava/communityprocess/final/jsr353/index.html and integrate wit your application or container of your choice.
A good set of samples for using this API are available at https://github.com/arun-gupta/javaee7-samples/tree/master/json .
To use JSON Processing in a Maven project you can use the following Maven coordinates:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
Or to include all of Java EE 8 add the following coordinates:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>1.8</version>
<scope>provided</scope>
</dependency>
JSON Processing 1.1 includes new JSON Pointer , JSON Patch and JSON Merge .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.