Implement basic json serialization.