I am creating a parser to create a units.json file from the default units.txt file. I have the following two formats as options and am requesting feedback on which one (or other options) the community thinks is best.
I am converting the entire database, the topic is for feedback on the format. I was hoping to get community consensus as to the preferred format in case anyone else has use for it. In the examples, one has units under a category object, the other has units, with a type property defining the category. In my mind, the first one is a bit easier to read through, but obviously has the downside of repetiveness.
Brian FrankThu 2 Apr 2015
Ah didn't get that! If you are trying to build a map to lookup a unit by name or symbol, then none of those really work (and 99% you will be looking up by symbol). So I think for efficient lookup you have to turn this into a separate lookup table anyways. You are probably better off creating a proper Unit API, then making the db an internal detail and giving people nice functions to iterate by quantity, lookup by name, etc.
Shawn Jacobson Tue 31 Mar 2015
I am creating a parser to create a units.json file from the default units.txt file. I have the following two formats as options and am requesting feedback on which one (or other options) the community thinks is best.
or
Brian Frank Wed 1 Apr 2015
I would just convert the whole database
Shawn Jacobson Wed 1 Apr 2015
I am converting the entire database, the topic is for feedback on the format. I was hoping to get community consensus as to the preferred format in case anyone else has use for it. In the examples, one has units under a category object, the other has units, with a type property defining the category. In my mind, the first one is a bit easier to read through, but obviously has the downside of repetiveness.
Brian Frank Thu 2 Apr 2015
Ah didn't get that! If you are trying to build a map to lookup a unit by name or symbol, then none of those really work (and 99% you will be looking up by symbol). So I think for efficient lookup you have to turn this into a separate lookup table anyways. You are probably better off creating a proper Unit API, then making the db an internal detail and giving people nice functions to iterate by quantity, lookup by name, etc.