#fit #ant #serde #file-format #garmin #content


A utility to parse ANT .FIT files and allow their contents to be serialized with serde

13 unstable releases

0.7.0 Mar 20, 2024
0.6.1 Sep 5, 2023
0.6.0 Jun 3, 2023
0.5.1 Aug 31, 2022
0.2.0 Jun 4, 2020

#359 in Parser implementations

Download history 54/week @ 2024-02-26 25/week @ 2024-03-04 46/week @ 2024-03-11 191/week @ 2024-03-18 79/week @ 2024-04-01 13/week @ 2024-04-08 13/week @ 2024-04-15 20/week @ 2024-04-22 13/week @ 2024-04-29 7/week @ 2024-05-06 34/week @ 2024-05-13 17/week @ 2024-05-20 100/week @ 2024-05-27 29/week @ 2024-06-03 10/week @ 2024-06-10

156 downloads per month

MIT license

95K SLoC


LICENSE Crates.io Version Docs.rs Build Status


Parses FIT formatted files and exports their contents using Serde. This code was heavily inspired by the python-fitparse module and uses the specifications defined by the Fit File SDK which is maintained by ANT.

The goal of this crate is to parse valid FIT files according to the defined FIT profile and export their data into a more usable format. To that end we leverage the Serde framework which allows end users to export the data in whatever format suits their needs. This library provides a fit_to_json example executable to serve as a template for any other serialization format implemented using Serde.


  • This library does not support writing FIT files at this time.
  • Files with Developer Data fields can be parsed but the developer fields are dropped.
  • The FIT SDK is regularly updated by Garmin/Ant this library may not be up to date; check the src/profile/messages.rs for the packaged version. Submit an issue and I will gladly bump it!


See library documentation at docs.rs/fitparser for full usage information. Below is a basic example of calling the parser on a FIT file.

use fitparser;
use std::fs::File;
use std::io::prelude::*;

println!("Parsing FIT files using Profile version: {}", fitparser::profile::VERSION);
let mut fp = File::open("tests/fixtures/Activity.fit")?;
for data in fitparser::from_reader(&mut fp)? {
    // print the data in FIT file
    println!("{:#?}", data);

For lower level control of the deserialization process, such as reading from a streaming data source you can use the de::FitStreamProcessor struct. See the streaming.rs example file for basic usage and manual processing of FitObject variants.

Additional decoding options are also available to customize the output of the parser. See the source code of the fitparser/src/de/mod.rs to view all options (or view the crate docs). The fit_to_json example program demos all of the currently available options as well.

Updating the FIT profile

All FIT files are generated based on a customizable profile. The profile used here is pulled from ANT's official SDK which can be accessed here. The cargo build command expects the environment variable FIT_PROFILE to be set to the path of the desired Profile.xlsx file and the FIT_PROFILE_VERSION variable to the appropriate version. To make updating simpler a script is provided ./bin/update_profile.sh that accepts the profile path the as first argument and optionally a profile version as the second. The version can be omitted if the path to the Profile.xlsx file contains FitSDKRelease_XX.YY.ZZ.

./bin/update_profile.sh ~/Downloads/FitSDKRelease_21.40.00/Profile.xlsx

A profile file is not required for building the library as the files generated are committed to the repository. The profile only needs updated to support custom extensions or when ANT releases an updated version.


~60K SLoC