You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by "John D. Ament" <jo...@apache.org> on 2017/06/04 13:32:51 UTC

Re: javax.json support

So I finally started digging into this.  I'm a bit lost, but its mostly
because of my poor understanding of how javax.json is meant to work.

http://www.oracle.com/technetwork/articles/java/json-1973242.html

I think what I want to do is create a "JuneauJsonReader" that implements
"javax.json.JsonReader" which delegates down to Juneau's JsonParser.  The
struggle is how to translate a JsonObject, which is just a map of
JsonValues.

Thoughts for a newbie?

John

On Sat, Mar 25, 2017 at 10:33 PM James Bognar <ja...@salesforce.com>
wrote:

> On Sat, Mar 25, 2017 at 10:11 PM John D. Ament <jo...@apache.org>
> wrote:
>
> > Hey guys
> >
> > Just wondering, would there be interest in pursuing a wrapper layer over
> > Juneau as an implementation of JSR-353, JSON-P https://jsonp.java.net/ ?
> >
> > Obviously we couldn't say that we pass the TCK, due to licensing issues,
> > but I think it would overall be a huge step in the direction of adoption
> if
> > we can implement these interfaces within Juneau.  And then, if we're on
> the
> > subject, adding support for JSON-B (
> > https://java.net/projects/jsonb-spec/pages/Home )
> >
> > (And of course, I expect a following email from James indicating that he
> > already has it, and I missed it.. :-)
> >
> > John
> >
>
> Nope...not implemented yet :-p
>
> I looked briefly at JSON-B when I added MessagePack support (which is very
> similar).  IIRC, the difficulty with JSON-B was that you needed to know the
> data sizes of the children before serialization which isn't easy doing when
> you're trying to do everything in a single pass of the data structure
> without a DOM.
>
> JSONP is interesting and Nick and Min wanted me to add that support years
> ago but I never got around to it. (and they left their project at IBM so
> nobody else was asking for it)
>
> I'm probably going to be busy for a while working on the proxy interface
> support with the Streams team, so anyone wishing to work on either, please
> feel free to step up!
>
>
>
>
> --
> James Bognar
>

Re: javax.json support

Posted by James Bognar <ja...@gmail.com>.
Is this JSR still alive?  Several of the links on the page are dead.

Some notes:

It's working with purely unstructured data, similar to JSON4J with
JSONObject and JSONArray objects.  This is similar to using Juneau with
ObjectMaps and ObjectLists.

The Object Model API is a DOM for JSON.  While you CAN accomplish the same
thing in Juneau using ObjectMap/ObjectList, one of the best features in
Juneau is that you don't NEED to construct a model.  You can marshall
directly against in-memory POJOs.

The JSR works with objects of type
JsonValue/JsonObject/JsonArray/JsonString/JsonNumber.  JsonObject/JsonArray
have ObjectMap/ObjectList equivalents, but for the others we simply
marshall against Java Numbers and Strings which is more efficent.

The streaming API is interesting.  Juneau currently doesn't have streaming
and event-driven support.

Takeaway:

If it's still alive, we could create a JsonReader/JsonWriter implementation
based on Juneau.  Some layer would have to be added to convert
ObjectMap/ObjectList/... to and from JsonObject/JsonArray/....
That would be pretty easy to implement.

If A more-efficient approach would be to alter the
JsonSerializer/JsonParser to support marshalling directly to and from
JsonObject/JsonArray objects.  That's a bit more difficult, but not
impossible.



On Sun, Jun 4, 2017 at 9:32 AM, John D. Ament <jo...@apache.org> wrote:

> So I finally started digging into this.  I'm a bit lost, but its mostly
> because of my poor understanding of how javax.json is meant to work.
>
> http://www.oracle.com/technetwork/articles/java/json-1973242.html
>
> I think what I want to do is create a "JuneauJsonReader" that implements
> "javax.json.JsonReader" which delegates down to Juneau's JsonParser.  The
> struggle is how to translate a JsonObject, which is just a map of
> JsonValues.
>
> Thoughts for a newbie?
>
> John
>
> On Sat, Mar 25, 2017 at 10:33 PM James Bognar <james.bognar@salesforce.com
> >
> wrote:
>
> > On Sat, Mar 25, 2017 at 10:11 PM John D. Ament <jo...@apache.org>
> > wrote:
> >
> > > Hey guys
> > >
> > > Just wondering, would there be interest in pursuing a wrapper layer
> over
> > > Juneau as an implementation of JSR-353, JSON-P https://jsonp.java.net/
> ?
> > >
> > > Obviously we couldn't say that we pass the TCK, due to licensing
> issues,
> > > but I think it would overall be a huge step in the direction of
> adoption
> > if
> > > we can implement these interfaces within Juneau.  And then, if we're on
> > the
> > > subject, adding support for JSON-B (
> > > https://java.net/projects/jsonb-spec/pages/Home )
> > >
> > > (And of course, I expect a following email from James indicating that
> he
> > > already has it, and I missed it.. :-)
> > >
> > > John
> > >
> >
> > Nope...not implemented yet :-p
> >
> > I looked briefly at JSON-B when I added MessagePack support (which is
> very
> > similar).  IIRC, the difficulty with JSON-B was that you needed to know
> the
> > data sizes of the children before serialization which isn't easy doing
> when
> > you're trying to do everything in a single pass of the data structure
> > without a DOM.
> >
> > JSONP is interesting and Nick and Min wanted me to add that support years
> > ago but I never got around to it. (and they left their project at IBM so
> > nobody else was asking for it)
> >
> > I'm probably going to be busy for a while working on the proxy interface
> > support with the Streams team, so anyone wishing to work on either,
> please
> > feel free to step up!
> >
> >
> >
> >
> > --
> > James Bognar
> >
>