https://github.com/softprops/lincolns
👉 #️⃣ A JSON Pointer index for line/column information within JSON and YAML content
https://github.com/softprops/lincolns
json tools yaml
Last synced: about 2 months ago
JSON representation
👉 #️⃣ A JSON Pointer index for line/column information within JSON and YAML content
- Host: GitHub
- URL: https://github.com/softprops/lincolns
- Owner: softprops
- License: mit
- Created: 2019-09-21T12:12:08.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-25T10:22:56.000Z (over 6 years ago)
- Last Synced: 2025-01-11T05:45:49.008Z (over 1 year ago)
- Topics: json, tools, yaml
- Language: Rust
- Homepage:
- Size: 1.02 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.log
- License: LICENSE
Awesome Lists containing this project
README
👉 #️⃣
lincolns
A JSON Pointer index for line/column information within JSON and YAML content
## 📦 install
Add the following to your `Cargo.toml` file's `[dependencies]` heading
```toml
[dependencies]
lincolns = "0.1"
```
## 🤸 usage
Lincolns exposes two sets of operations: one to load YAML/JSON content into an index for lookup and one to perform the lookup
```rust
use lincolns::Position;
use std::error::Error;
fn main() -> Result<(), Box> {
Ok(
println!(
"{:#?}",
from_str("path/to/file.yml")?.get("/path/to/field")
)
)
}
```
If you care to see what JSON pointer paths are available you can iterate over them using `iter`
```rust
use lincolns::from_str;
use std::error::Error;
fn main() -> Result<(), Box> {
for (ptr, pos) in from_str("path/to/file.yml")?.iter() {
println!("{} => {:?}", ptr, pos);
}
Ok(())
}
```
That's it.
## 🤔 lincolns?
lin(e and )col(umn)n(umber)s
Doug Tangren (softprops) 2019