On Wed, 12 Dec 2018 07:26:44 -0800 (PST), Brian Adkins <lojicdot...@gmail.com> wrote:
>I have some simple serialization needs. In Ruby, I would always serialize >an object to JSON and store in a postgres text column. However, w/ Racket, >it appears another option is to simply use read/write. Any reason not to >use read/write for serialization instead of JSON? As Jon mentioned, PG can index the JSON column and it would be interoperable with other non-Racket clients. That said: One reason you might prefer Racket over JSON is if you frequently need to store large integer values. JSON encodes 64-bit ints as IEEE doubles, and doubles do not offer the full range: values (positive or negative) having magnitude greater than 2**52 will be mangled by JSON and will have to translated to strings. PG can index Racket serializations (as text). JSON is a serialized hash - i.e. the values are tagged - so if you do choose to use Racket's own serialization, you might want to use a hash so (like the JSON) the values can be indexed by tag. George -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.