xTomlJ is a complete TOML parser with the following attributes:
- Supports the latest TOML specification version (1.0.0-rc.1).
- Provides detailed error reporting, including error position.
- Performs error recovery, allowing parsing to continue after an error.
It uses the ANTLR parser-generator and runtime library.
This is a fork from the original project TomlJ. It was created because the original project appears to be inactive.
Parsing is straightforward:
Path source = Paths.get("/path/to/file.toml");
TomlParseResult result = Toml.parse(source);
result.errors().forEach(error -> System.err.println(error.toString()));
String value = result.getString("a. dotted . key");
xTomlJ is published to Maven Central.
To include using Maven:
<dependency>
<groupId>io.github.xtomlj</groupId>
<artifactId>xtomlj</artifactId>
<version>1.1.0</version>
</dependency>
To include using Gradle: implementation 'io.github.xtomlj:xtomlj:1.1.0'