-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Description
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[ ] latest
[ ] @next
[x] "typeorm": "^0.2.17"
Steps to reproduce or a small repository showing the problem:
Well, I'm trying to make an array for a 'custom field' feature of my backend. In my model, I have
@Column("simple-json", { nullable: true })
public customFields!: { name: string, content: string };which seems correct, given the documentation.
However, then running...
char.customFields = req.body.customFields ? req.body.customFields : char.customFields;
results in this error.
SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at Function.DateUtils.stringToSimpleJson (C:\Users\Hayden\Source\Repos\roleplay-system\api\src\util\DateUtils.ts:173:49)
at PostgresDriver.prepareHydratedValue (C:\Users\Hayden\Source\Repos\roleplay-system\api\src\driver\postgres\PostgresDriver.ts:483:31)
at C:\Users\Hayden\Source\Repos\roleplay-system\api\src\query-builder\transformer\RawSqlResultsToEntityTransformer.ts:143:55
at Array.forEach (<anonymous>)
at RawSqlResultsToEntityTransformer.transformColumns (C:\Users\Hayden\Source\Repos\roleplay-system\api\src\query-builder\transformer\RawSqlResultsToEntityTransformer.ts:128:26)
at RawSqlResultsToEntityTransformer.transformRawResultsGroup (C:\Users\Hayden\Source\Repos\roleplay-system\api\src\query-builder\transformer\RawSqlResultsToEntityTransformer.ts:105:33)
at C:\Users\Hayden\Source\Repos\roleplay-system\api\src\query-builder\transformer\RawSqlResultsToEntityTransformer.ts:43:33
at Map.forEach (<anonymous>)
at RawSqlResultsToEntityTransformer.transform (C:\Users\Hayden\Source\Repos\roleplay-system\api\src\query-builder\transformer\RawSqlResultsToEntityTransformer.ts:42:15)
This seems to be something that happened before, back in November 2016. I read #96 and it seems like it was fixed. However... it now seems like the objects hitting TypeORM are still objects, so they're either not being stringified (which I did try doing manually to no success) or something else is going on here.
If it's my code error, please let me know.