Inserting Json objects in PostgreSQL json fields with Anorm Inserting Json objects in PostgreSQL json fields with Anorm json json

Inserting Json objects in PostgreSQL json fields with Anorm


For the Play 2.4 and above use the anorm.Object(value: org.postgresql.util.PGobject) class instead of value directly:

val pgObject = new org.postgresql.util.PGobject();pgObject.setType("json");pgObject.setValue(profile);val sql = SQL("insert into profiles (profile) values ({profile})")    .on("profile" -> anorm.Object(pgObject))