PostgreSQL: Add support for array as root element in JSON

Currently when trying to store an array in a JSON column, the array is serialized as YAML, which results in:

```
ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: org.postgresql.util.PSQLException: ERROR: invalid input syntax for type json
  Detail: Token "-" is invalid.
  Position: 30
  Where: JSON data, line 1: -...: UPDATE "things" SET "data" = '---
```

This fix is ported from ActiveRecord 4.0.1 (https://github.com/rails/rails/commit/9b66187622453679497ad2fed4f333e2fca32150).