converting IANA enterprise-numbers to JSON


http://www.iana.org/assignments/enterprise-numbers maps all SMI Network Management Private Enterprise Codes in iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) to organizations, contacts and e-mails. I had to convert this file in JSON to be able to load it into Agent-Jones, my SNMP web-service.

At first look, the file looks easy to parse. However, it is buggy at many places, with wrong number of spaces, line-continuations, empty lines, etc.

I wrote a quick script to solve the issue. Use it as

python iana_enterprise_numbers_convert.py \
-i http://www.iana.org/assignments/enterprise-numbers \
-o ./enterprise-numbers.json

The resulting file should be valid json.