Adonis-jsonable is a trait for AdonisJS Lucid models (v4.x) that automatically stringifies and parses PostgreSQL JSON fields. It solves the issue where knex.js requires JSON stringification before saving, but after saving the in-memory model retains the stringified value instead of the original object. Version 0.2.1, last updated in 2017, no active maintenance. Use it by defining jsonFields on your model or passing an array to this.addTrait. Only supports Adonis 4 with @adonisjs/fold peer dependency and the old provider system.
npm install adonis-jsonableNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Registers the Jsonable provider, defines a User model with jsonFields and boot method, and shows automatic JSON stringify/parse on create.
Migrate to Adonis 5+ and use @adonisjs/lucid built-in JSON support or a modern alternative.
Define jsonFields as an instance getter, not static.
Manually handle deep mutations or use a alternative like @adonisjs/lucid migrations.
Upgrade to v0.2.1.
Add 'adonis-jsonable/providers/JsonableProvider' to your providers list in start/app.js.
Run `npm install --save adonis-jsonable` and ensure the string path is correct.
Add a getter `get jsonFields() { return ['fieldName'] }` inside your model class.