Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Rename shove method
  • Loading branch information
0x7fff5238100b committed Feb 23, 2023
1 parent 628ec39 commit 3738e50
Show file tree
Hide file tree
Showing 6 changed files with 343 additions and 275 deletions.
217 changes: 0 additions & 217 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ exclude = [".gitignore"]
serde_json = "1.0.91"
pest = "2.5.4"
pest_derive = "2.5.4"
log = "0.4"
env_logger = "0.10.0"
serde = { version = "1.0.152", features = ["derive"] }
dynfmt = { version = "0.1.5", features = ["curly"] }
58 changes: 52 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@

Jetro is a tool for transforming, querying and comparing data in JSON format.

```rust
let data = serde_json::json!({
"name": "mr snuggle",
"some_entry": {
"some_obj": {
"obj": {
"a": "object_a",
"b": "object_b",
"c": "object_c",
"d": "object_d"
}
}
}
});

let mut values = Path::collect(data, ">/..obj/#pick('a','b')");

#[derive(Serialize, Deserialize)]
struct Output {
a: String,
b: String,
}

let output: Option<Output> = values.from_index(0);
```

# example

```json
Expand Down Expand Up @@ -38,7 +64,7 @@ Jetro is a tool for transforming, querying and comparing data in JSON format.

### Queries

```json
```
>/bar
```
<details>
Expand All @@ -65,8 +91,8 @@ Jetro is a tool for transforming, querying and comparing data in JSON format.

---

```json
>/pick('foo', >/..person/formats('Herrn {} {}', 'firstname', 'lastname') as 'fullname'/fullname as 'fullname')
```
>/#pick('foo', >/..person/#formats('Herrn {} {}', 'firstname', 'lastname') as 'fullname'/fullname as 'fullname')
```

<details>
Expand Down Expand Up @@ -95,8 +121,8 @@ Jetro is a tool for transforming, querying and comparing data in JSON format.

---

```json
>/pick('friend', >/..person/formats('Herrn {} {}', 'firstname', 'lastname') as 'fullname'/fullname as 'fullname', >/foo/..contract)
```
>/#pick('friend', >/..person/#formats('Herrn {} {}', 'firstname', 'lastname') as 'fullname'/fullname as 'fullname', >/foo/..contract)
```

<details>
Expand Down Expand Up @@ -136,7 +162,7 @@ Jetro is a tool for transforming, querying and comparing data in JSON format.

---

```json
```
>/..meows/[4:]
```

Expand All @@ -152,3 +178,23 @@ Jetro is a tool for transforming, querying and comparing data in JSON format.
]
```
</details>

---

```
>/..foo/..contract/#pick('kind' as 'contract', </..person/#formats('Welcome {}', 'firstname') as 'welcome_message'/#pick('welcome_message'))
```

<details>
<summary>See output</summary>

### result

```json
{
"contract": "Furry Purr",
"welcome_message": "Welcome Mio"
}

```
</details>
Loading

0 comments on commit 3738e50

Please sign in to comment.