Objection.js really supports relational as well as for JSONB data .
You do not need to do any tricks for parsing / formatting json data. All this is done automatically. You can declare schemes that allow you to check the data that you are going to place in the database, etc.
You can insert nested hierarchies of relational objects into the database, and the rows will be generated to correct the tables, and you have a javascript API for querying data inside JSON columns, so you do not need to write RAW SQL for this.
EDIT:
I have no idea why the voices given here (currently -2), Objection.js still have the best support for Postgresql JSONB operations in the node world (and the only choice in current answers that has special support for postgresql jsonb).
The latest addition was support for fixing only a part of the data inside the JSONB column, where objection.js automatically creates jsonb_set() calls for you.
eg:
ModelWithJsonColumn.query().update({ 'jsonColumn:attribute' : 'new value', otherColum: ref('jsonColumn:extractThisAttribute') }).where('id', 1).returning('*')
will create an update request as follows:
update "ModelWithJsonColumn" set "jsonColumn" = jsonb_set("jsonColumn", '{attribute}', to_jsonb('new value'), true), "otherColumn" = "jsonColumn"
You can also use the ref() syntax in almost every query building method, such as
.select(['id', ref('jsonArrayColumn:[0]')])
or
.where('name', ref('jsonColumn:middleName'))
or even with compounds
.join('PetTable', ref('PetTable.jsonColumn:details.name'), '=', ref('ThisTable.someOtherJsonbColumn:dogName'))