make to_json configurable