I think you missed a 2.5 which is to use the information in DOM objects to perform useful work.
On Wed, May 21, 2025, 1:04 PM Archie Cobbs <archie.co...@gmail.com> wrote: > On Wed, May 21, 2025 at 11:30 AM Paul Sandoz <paul.san...@oracle.com> > wrote: > >> I consider this a “known unknown” (in the words of Mr. Rumsfeld). We >> would need to explore this area throughly, which includes the >> interconnection with Serialization 2.0, before we really know what we can >> and should do in the near and long term. That’s a significant effort, and I >> would like to separate it out from the non-trivial effort to first get a >> rather modest API over the line. > > > I think the discussions about object mapping and serialization are > important and super interesting, but as Paul points out, not really an > immediate concern wrt. this proposal. > > In trying to understand this discussion, there are so many different > concepts stirred up it's hard to keep track. It was helpful for me to go > through the exercise of trying to partition the discussion space. Below is > my feeble attempt at that... > > Side note: for better or worse, there are lots of parallels here with XML, > so I expect the solutions to parallel the XML solutions, for many of the > same reasons. We should also avoid parallelling the mistakes (e.g., > including too much functionality in the JDK which gets stale over time). > > Q1: What is JSON? Just like XML, it's a specification for structured > documents. By "structured" we mean the syntax implies a nested tree-like > structure (by "document" we mean "file" or "streams of bytes"). > > Q2: What do people want to do with JSON? > > 1. Model a JSON document as Java objects in memory (using a "document > object model" or DOM). Analogy: org.w3c.dom > > 2. Convert JSON DOM objects (see #1) to/from JSON documents. Analogy: > {javax,jakarta}.xml.{parsers,transform} > > 3. Transform JSON documents. Analogy {javax,jakarta}.xml.transform > > 4. Read/write normal Java objects to/from JSON ("object mapping"). > Analogy: {javax,jakarta}.xml.bind (JAXB), JiBX > > 5. Read/write normal Java objects, where JSON is one possible encoding > ("serialization 2.0"). Analogy: java.beans.XMLEncoder (!?) > > To me these are mostly separate problems whose solutions can be solved > separately, each building on the previous (analogous to what was done with > XML). > > So what problem is this new API trying to solve? Just #1 and #2. > > Of course, you probably want to use the solutions to problem 1 and 2 in > your solution to problems 3, 4, and 5. > > But let's respect the ordering here. In solving problems 1 and 2, we > should focus on those problems only. The solution to problems 1 and 2, if > done well, will automatically be a good foundation for solving problems 3, > 4, and 5, etc. > > -Archie > > P.S. I'm interested in "serialization 2.0" too - and that discussion must > be happening somewhere else... where? > > -- > Archie L. Cobbs >