users@jsonb-spec.java.net

[jsonb-spec users] Re: ***SPAM*** Suggestions for JSR-367

From: Dmitry Kornilov <dmitry.kornilov_at_oracle.com>
Date: Tue, 09 Aug 2016 12:05:13 +0200

Hi Omar,

 

I am glad that you liked the spec and thanks for your suggestions.

We made the first version of the spec very lightweight, but covering all requested features. We will extend it in future. Our task was not reinventing JSON binding and come out with new exciting features, but analyze the features of existing binding frameworks (Genson, Jackson, Gson, etc.), extract the most common from them make it standard.

We didn’t focus on JSON schema. It was not requested by the community. JSON schema specification itself is still in the draft status and actually was expired on 3 years ago (see http://json-schema.org/latest/json-schema-core.html). IMHO, it’s not a priority at the moment. We better concentrate on more requested features such as JSONPointer.

Generics are fully supported by the spec. I see only one improvement which we can think about. We are currently passing runtime type to jsonb.xxx methods in parameter of java.lang.reflect.Type type. It is inconvenient because requires making an instance which can be expensive. Also the construction itself looks ugly. Example:

ArrayList<MyPojo>> result = jsonb.fromJson(jsonString, (new ArrayList<MyPojo>>(){}).getType());

 

The idea was to use TypeToken instead like this:

List<MyPojo> result1 = jsonb.fromJson(jsonString, new TypeToken<List<MyPojo>>());

 

Other Java frameworks (I suppose CDI) are facing the same problem and have their own implementation of TypeToken. I suppose it’s a good idea to standardize TypeToken and include it in JDK so all frameworks can use one version of it.

 

Thanks,

Dmitry

 

 

From: Omar Bashir <obashir_at_yahoo.com>
Reply-To: Omar Bashir <obashir_at_yahoo.com>
Date: Tuesday 9 August 2016 at 01:12
To: "users_at_jsonb-spec.java.net" <users_at_jsonb-spec.java.net>
Cc: Martijn Verburg <martijnverburg_at_gmail.com>
Subject: ***SPAM*** [jsonb-spec users] Suggestions for JSR-367

 

Hi,

 

I'm Omar from the London Java Community. We've just completed our early review of this JSR and we think it's great but had following suggestions.

 

I was expecting this JSR also to focus on autogenerating classes from JSON schema similar to JAXB using XML schema to generate classes that can be serialised and deserialised. That can be very useful for efficient data validation even prior to deserialisation.

 

The JSR only seems to focuses on serialisation and deserialisation. In that perspective, I think it is fairly comprehensive. Generics is a challenging area because of erasure as mentioned in the JSR. While comprehensive measures to infer types from deserialised JSON documents have been specified, it may be possible to use annotations to guide this inference.

 

I shall be grateful for advice and suggestions on the above.

 

Thank you and best wishes

 

Omar