summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-09-27 21:39:28 +0100
committerMichael Williamson <mike@zwobble.org>2013-09-27 21:39:28 +0100
commit51189b3e5a4559419fbd33b48932e98be246a9ef (patch)
tree063cf73422b9f096bf3fea6cc4d78055fc155fa9
parent14ccbee3f9feab1504f79e82e7a9696b379f212c (diff)
Update README.md for changes in API
-rw-r--r--README.md28
1 files changed, 25 insertions, 3 deletions
diff --git a/README.md b/README.md
index 58d827e..dd1342d 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,29 @@ This project contains Python bindings for [jq](http://stedolan.github.io/jq/).
```python
from jq import jq
-assert [2, 3, 4] == jq("[.[]+1]").transform([1, 2, 3]).json()
-assert "[2,3,4]" == str(jq("[.[]+1]").transform([1, 2, 3]))
-assert "[2,3,4]" == str(jq("[.[]+1]").transform("[1, 2, 3]", raw=True))
+jq(".").transform("42") == "42"
+```
+
+The `raw_input` argument can be used to treat the input as a raw JSON string:
+
+```python
+jq(".").transform("42", raw_input=True) == 42
+```
+
+The `raw_output` argument can be used to serialise the output into a JSON string:
+
+```python
+jq(".").transform("42", raw_output=True) == '"42"'
+```
+
+The `multiple_output` argument can be used for cases when multiple output elements are expected:
+
+```python
+jq(".[]+1").transform([1, 2, 3], multiple_output=True) == [2, 3, 4]
+```
+
+If there are multiple output elements, but `multiple_output` is not set to `True`, then the first output is used:
+
+```python
+jq(".[]+1").transform([1, 2, 3]) == 2
```