Eric Yin
Eric Yin

Reputation: 8993

Best method to compress JSON string in term of performance and compress radio

For a JSON string, contains all kinds of settings, numbers, text etc (no fancy binaries but may include Unicode/UTF8). Total JSON string fairly fall into 10k~50K range.

I want to compress it before save to database.

So I wonder which compress method should I choose, I am using c# 4, I know I can choose gzip and deflate but the compression radio is not good (although speed is good).

More specific, compress can be a little slow (since only once) but should be small. Decompress should be lighting fast since decompress happens lots.

Please give some advice.

Upvotes: 1

Views: 7574

Answers (1)

Timmerz
Timmerz

Reputation: 6199

gzip should be fine...however, you might want to store it as a binary and maybe use this library:

http://www.7-zip.org/sdk.html

however, it depends on your needs. are you going to smallest size, fastest compression? one point to note is that it won't be searchable.

Upvotes: 1

Related Questions