Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 1.79.0 lints #40

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,23 @@ Then you can evaluate an expression with JSON input like this:
use bumpalo::Bump;
use jsonata_rs::JsonAta;

fn main() {
// Create an arena for allocating values, this will go away in future except for advanced use cases
let arena = Bump::new();
// Create an arena for allocating values, this will go away in future except for advanced use cases
let arena = Bump::new();

// Provide some JSON input, this could be read from a file or come from the network
let input = "{ \"name\": \"world\" }";
// Provide some JSON input, this could be read from a file or come from the network
let input = "{ \"name\": \"world\" }";

// The JSONata expression to evaluate
let expr = "\"Hello, \" & name & \"!\"";
// The JSONata expression to evaluate
let expr = "\"Hello, \" & name & \"!\"";

// Parse the expression - this could fail
let jsonata = JsonAta::new(expr, &arena).unwrap();
// Parse the expression - this could fail
let jsonata = JsonAta::new(expr, &arena).unwrap();

// Evaluate the expression against the input - this could fail
let result = jsonata.evaluate(Some(input)).unwrap();
// Evaluate the expression against the input - this could fail
let result = jsonata.evaluate(Some(input)).unwrap();

// Serialize the result into JSON
println!("{}", result.serialize(false));
}
// Serialize the result into JSON
println!("{}", result.serialize(false));
```

There's also a basic CLI tool:
Expand Down