Skip to content

Showing Json field (mysql) in API (decode or formated) #3783

Answered by EwertonDutra
EwertonDutra asked this question in Help
Discussion options

You must be logged in to vote

For now I used an option that I was satisfied

@column({
    // prepare: (value) => JSON.stringify(value),
    consume: (value) => JSON.parse(value),
  })
  public atributos: object | null;

The prepare is commented because I didn't have to do anything to save it correctly, but I left it commented so I can remember that it has the option too 😜

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by thetutlage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant