Updated code to work with latest rust master

- namespaced enums
- use new json serialization API