-1

Are there any trade-offs in converting a Parse object to itsJSON format before sending it to the client? const data = await query.first(); res.success({ data: data.toJSON() });

I find shallow redux updates on my client, never being rendered if I use the actual Parse server Object format. So, I was thinking of converting every response to regular JSON before sending it to the client.

PS: I never fire any query requests like .save() or .find() from the client. So, I have really no need to have it in the Parse Object format.

InfinitePrime
  • 1,718
  • 15
  • 18

1 Answers1

0

I do not think that their is any tradeoffs

I however think that it should be more desirable to transpose the data to JSON, instead of just converting the entire object to JSON so save data(if you are sending the data over the network) and also to normalize the structure for Pointers and Relations.

ribads
  • 393
  • 3
  • 7
  • I'm looking for a more concrete answer backed by use case or data. Just "not thinking" wont cut it. – InfinitePrime Jun 25 '18 at 14:58
  • @InfinitePrime you won't get a a scientifically correct answer to your question here (or anywhere, really), @ribads' answer is just alright. Your actual problem about rendering obviously is not related to the data format but to your client-side handling of the data. To give you some more "I think"'s on the topic: using `Parse.Object`s allows you to share code between frontend and backend; using queries might come in handy later. Using custom `JSON` on the other hand has the big advantage of reducing the dependency on `Parse` in your frontend code (only the API layer needs to use `Parse`). – dr_barto Jul 15 '18 at 09:27