# Dict with JSON or JSONB on Postgres

**URL:** <https://discuss.tryton.org/t/dict-with-json-or-jsonb-on-postgres/1607>\
**Category:** Developer\
**Created:** [July 26, 2019, 12:54pm UTC](https://discuss.tryton.org/t/dict-with-json-or-jsonb-on-postgres/1607 "2019-07-26T12:54:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fmorato](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/fmorato/32/109_2.png) [@fmorato](https://discuss.tryton.org/u/fmorato)\
**Post date:** [July 26, 2019, 12:54pm UTC](https://discuss.tryton.org/t/dict-with-json-or-jsonb-on-postgres/1607/1 "2019-07-26T12:54:05Z")

</div>

On the docs for the [`Dict`](https://docs.tryton.org/projects/server/en/latest/ref/models/fields.html?highlight=json#dict) field, it says:

> It is possible to store the dict as JSON in the database if the backend supports by manually altering the column type to JSON on the database.

Does it work with JSONB on postgres?

Why isn’t the column created as JSON(B) automatically if the backend supports it? Is there any caveat for using the native JSON(B) support?

> **[8.14. JSON Types](https://www.postgresql.org/docs/11/datatype-json.html)**
>
> 8.14. JSON Types # 8.14.1. JSON Input and Output Syntax 8.14.2. Designing JSON Documents 8.14.3. jsonb Containment and Existence 8.14.4. jsonb …

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [July 26, 2019, 1:15pm UTC](https://discuss.tryton.org/t/dict-with-json-or-jsonb-on-postgres/1607/2 "2019-07-26T13:15:48Z")

</div>

At that time, JSONB was not supported by all supported PostgreSQL versions.  
Also as it is a type of data that is not supported by all databases, we prefer to have safe default like that code does not rely on specific features but still be able to customize for specific cases.
