Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10

Exporting JSON

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

// Fetch books and format them as JSON
String json = create.selectFrom(BOOK).fetch().formatJSON();

The above query will result in a JSON document looking like the following one:

{"fields":[{"schema":"schema-1","table":"table-1","name":"field-1","type":"type-1"},
           {"schema":"schema-2","table":"table-2","name":"field-2","type":"type-2"},
           ...,
           {"schema":"schema-n","table":"table-n","name":"field-n","type":"type-n"}],
 "records":[[value-1-1,value-1-2,...,value-1-n],
            [value-2-1,value-2-2,...,value-2-n]]}

Note: This format has been modified in jOOQ 2.6.0 and 3.7.0

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo