Skip to content

Commit

Permalink
mention array notation in the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
can3p committed Apr 15, 2024
1 parent 43da6e0 commit e8c60a4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Or worse, where you had to count spaces in yaml? Fear no more, sackmesser will t

Operations have a signature like `op_name(path, args*)` where

* path is dot delimited, you could use quotes in case field names contain spaces, dots, commas, etc:
* path is dot delimited, you could use quotes in case field names contain spaces, dots, commas, etc. For array access you can use array notation:

```
echo '{ "a" : { "test prop": 1 } }' | sackmesser mod 'set(a."test prop", "test")'
Expand All @@ -27,6 +27,16 @@ Operations have a signature like `op_name(path, args*)` where
}
```

```
echo '{ "a" : { "test prop": [ 1 , true ] } }' | sackmesser mod 'set(a."test prop"[1], "test")'
"a": {
"test prop": [
1,
"test"
]
}
```

* Zero or more arguments are required for an operation. An argument could be one of
- a number
- `null`
Expand Down

0 comments on commit e8c60a4

Please sign in to comment.