Skip to content

Commit

Permalink
updated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jlangch committed Oct 20, 2023
1 parent 3e4e4eb commit 13ac722
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
21 changes: 19 additions & 2 deletions doc/readme/json-lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ converted. E.g. there is no real decimal type and Venice `int` is converted to `

### Streams

JSON Lines can be spit to Java OutputStreams, Writers, or files
JSON can be spit to Java OutputStreams, Writers, or files:
* `io/bytebuf-out-stream`
* `io/file-out-stream`
* `io/buffered-writer`
* `io/file`

```clojure
(do
Expand Down Expand Up @@ -73,7 +77,20 @@ JSON Lines can be spit to Java OutputStreams, Writers, or files
(flush wr)))
```

JSON can be slurped from Java InputStreams, Readers, or files

JSON can be slurped from byte buffers, Java InputStreams, Readers, or files:
* `bytebuf`
* `io/file-in-stream`
* `io/bytebuf-in-stream`
* `io/buffered-reader`
* `io/file`

```clojure
(do
(load-module :jsonl)

(jsonl/slurp (io/file "data.jsonl")))
```

```clojure
(do
Expand Down
18 changes: 16 additions & 2 deletions doc/readme/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ converted. E.g. there is no real decimal type and Venice `int` is converted to `

### Streams

JSON can be spit to Java OutputStreams, Writers, or files
JSON can be spit to Java OutputStreams, Writers, or files:
* `io/bytebuf-out-stream`
* `io/file-out-stream`
* `io/buffered-writer`
* `io/file`

```clojure
(let [out (io/bytebuf-out-stream)]
Expand All @@ -33,7 +37,17 @@ JSON can be spit to Java OutputStreams, Writers, or files
;;=> "{\"a\":100,\"b\":100,\"c\":[10,20,30]}"
```

JSON can be slurped from Java InputStreams, Readers, or files

JSON can be slurped from byte buffers, Java InputStreams, Readers, or files:
* `bytebuf`
* `io/file-in-stream`
* `io/bytebuf-in-stream`
* `io/buffered-reader`
* `io/file`

```clojure
(json/slurp (io/file "data.jsonl"))
```

```clojure
(let [json (json/write-str {:a 100 :b 100})]
Expand Down

0 comments on commit 13ac722

Please sign in to comment.