simov / express-admin

MySQL, MariaDB, PostgreSQL, SQLite admin for Node.js
MIT License
1.17k stars 223 forks source link

PostgreSQL JSON data type shows as '[object Object]' #71

Open CarlosML opened 9 years ago

CarlosML commented 9 years ago

If you define a column as JSON with Postgres, it shows as '[object Object]' in express-admin.

simov commented 9 years ago

Thanks for reporting this issue, I definitely don't have tests for this case. What do you think will be the best way to visualize that type of data inside the admin, and enable the user to modify it?

emresebat commented 8 years ago

Hi

I had the same issue and a quick solution is modifying exports.value function in node_modules/express-admin/lib/format/form.js as:

else if (column.control.textarea && typeof value === 'object') {
    return JSON.stringify(value);
}

else {
    return value;
}

It displays the json value as string, then when I've time I'll add this editor so it will be also editable easily

jsoneditor

cercata commented 8 years ago

Same here with interval types.

A similar quick solution works on form.js:

  else if (column.control.text && typeof value === 'object' && value.toPostgres != 'undefined') {
    return value.toPostgres()
  }