dronetag / opendronelist

A public community-driven list of drones and their common properties
https://dronetag.github.io/opendronelist/
MIT License
16 stars 5 forks source link

Convert to correct types in JSON convertors #2

Open marianhlavac opened 2 years ago

marianhlavac commented 2 years ago

Currently, all fields in JSONs, except for the boolean fields, are strings. Numeric fields should be represented as numbers.

For example, this current output:

{
        "manufacturer": "3D Robotics",
        "name": "Aero",
        "uas_class": "none",
        "weight": "3000",
        "max_takeoff": "3000",
        "endurance": "40",
        "has_camera": null,
        "is_toy": null
    },

Should look like this:

{
        "manufacturer": "3D Robotics",
        "name": "Aero",
        "uas_class": "none",
        "weight": 3000,
        "max_takeoff": 3000,
        "endurance": 40,
        "has_camera": null,
        "is_toy": null
    },

If there is a numeric value missing, it should be null.

marianhlavac commented 2 years ago

Idea: It would also be nice to take into account different values in the CSV representing the boolean values, such as "yes", "no", 1, 0, "y", "n". While we keep the CSV consistent and we use strictly true/false, sometimes inconsistency could slip through and by making the conversion more forgiving, the CSV could be still valid and converted correctly.