Fix JSON serialization of required attribute. Closes #39.