diff options
| author | Jonathan Marler <johnnymarler@gmail.com> | 2022-06-30 15:02:09 -0600 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-24 11:51:59 +0300 |
| commit | f598234ee820ca0d57946542a852f193b21d847f (patch) | |
| tree | 5ab1dda8719c06cd4b52e2b7ce7c8f0c4b8f417a /src/Module.zig | |
| parent | a2ab9e36faded9755ecc1fe809c49140120c3c61 (diff) | |
| download | zig-f598234ee820ca0d57946542a852f193b21d847f.tar.gz zig-f598234ee820ca0d57946542a852f193b21d847f.zip | |
std.json: expose encodeJsonString and encodeJsonStringChars
Expose 2 functions from std.json. These functions take a slice of bytes
and forward them to a given writer as a JSON encoded string.
The use case I have for this is in a custom JsonStringWriter. This writer
takes data and automatically encodes it as JSON string characters and
forwards it to an underlying writer. I use this JsonStringWriter in
combination with std.fmt.format to go directly from a format string/arg
pair to JSON. This way I don't have to format my string into a separate
buffer first and encode it afterwards, which avoids the need to create
a temporary buffer to hold the unencoded but formatted string.
Diffstat (limited to 'src/Module.zig')
0 files changed, 0 insertions, 0 deletions
