Skip to content

write-value closes the object #61

@helins

Description

@helins

Writing to an object in a streaming fashion is a typical use case and since Jsonista aims for performance, supporting that is rather expected. As opposed to using write-value-as-string or write-value-as-bytes and then copying the result to an object like a writer.

Currently, this is not possible since write-value closes the given object, hence an exception is thrown. Or maybe is it Jackson itself?

I realized this while trying to write a line-delimited JSON file.

(with-open [out (clojure.java.io/writer "/tmp/foo.json")]
    (json/write-value out [:a])
    (.write out (int \newline))
    (json/write-value out [:b]))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions