police-github / police-github.github.io

37 stars 10 forks source link

compress data.json #3

Closed williamli closed 5 years ago

williamli commented 5 years ago

you can compress data.json by

  1. use 1 letter for property names, instead of name, use n etc
  2. source URL can be deduced from the file name. instead of storing https://www.gld.gov.hk/egazette/pdf/20040814/cgn200408142135.pdf, just store cgn200408142135, .pdf can be added later, https://www.gld.gov.hk/egazette/pdf/[X] is always the same where [X] = the 8 digits after cgn in filename.
  3. store position type as a number, instead of "警長" you store 1, and have a lookup table in app.
  4. for "auxiliary", use 0 and 1 instead of true / false
police-github commented 5 years ago

Done

williamli commented 5 years ago

nice!

the file size went down from 6MB to 2MB.

btw, I am going to use your data.json / data.compress.json for another open sourced project

hope it's ok. i will add your repo to my About section.

police-github commented 5 years ago

The information is public resource from http://www.gld.gov.hk/egazette/. Feel free to use it.