fix to_json
add api docs