parsa
parsa

Reputation: 985

Does Java 9 contain built-in JSON?

I was wondering if Java 9 has built-in support for JSON. If so how can I import it? I'm writing a socket program so I'm not talking about Java EE and my target to import to is a simple Java SE class.

Upvotes: 1

Views: 5850

Answers (2)

user9455968
user9455968

Reputation:

There is JSON-P which has a JSR.

JSON Processing (JSON-P) is a Java API to process (for e.g. parse, generate, transform and query) JSON messages. It produces and consumes JSON text in a streaming fashion (similar to StAX API for XML) and allows to build a Java object model for JSON text using API classes (similar to DOM API for XML).

That's as close as you can get to official JSON support in Java.

Upvotes: 7

Honinbo Shusaku
Honinbo Shusaku

Reputation: 1521

There was a proposal to drop the feature by Mark Reinhold, Oracle’s Head of the Java:

We may reconsider this [JSON API] JEP for JDK 10 or a later release, especially if new language features such as value types and generics over primitive types (JEP 218) enable a more compact and expressive API.

And it doesn't appear in the finalized features. So it appears Java 9 doesn't have a native JSON API.

Upvotes: 12

Related Questions