This article illustrates various ways of turning a flat representation of hierarchical dataa into an object or JSON hierarchy, using SQL, jOOQ, or vanilla Java.| Java, SQL and jOOQ.