aboutsummaryrefslogtreecommitdiff
path: root/lib/std/json
AgeCommit message (Collapse)Author
2022-07-23std.json: Fix parsing of large numbersominitay
Numbers greater than about 2^53 are encoded as strings in JSON. std.json.parseInternal previously errored out in this condition.
2022-07-07std.json: move tests to json/test.zig fileAndrew Kelley
This accomplishes two things: * Works around #8442 by putting stage1-specific logic in to disable all the std.json tests. * Slightly reduces installation size of zig since std lib files ending in "test.zig" are excluded from being installed.
2022-06-29std.json: Support disabling indent (#11823)May B
Newline Delimited JSON (ndjson) expect compact json without newline inside its content Add None to StringfyOptions.indent and move newline writeByte inside StringfyOptions.outputIndent
2021-11-30allocgate: renamed getAllocator function to allocatorLee Cannon
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-05-13std/json: Fix premature closing brace being considered valid JSONMatthew Borkowski
return error from StreamingParser when reading closing brace when expecting value for an object key
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-04-11std.meta: add isErrorxackus
2021-04-04Tidy-up in json test module (#8431)Lewis Gaul
* Switch json testing 'roundTrip()' to use FixedBufferStream, improve error handling, remove comptime from param * Add 'try' to calls to roundTrip() that can now return an error * Remove comptime from params in json testing, replace expect(false) with letting error propagate * Add 'try' to calls to ok() that can now return an error Co-authored-by: Lewis Gaul <legaul@cisco.com>
2021-04-04Switch std.json to use an ordered hashmapLewis Gaul
2021-02-27HashMap.put returns !void, not a !booldaurnimator
2021-01-07Reduce use of deprecated IO typesJay Petacat
Related: #4917
2020-12-31Year++Frank Denis
2020-12-08std.json: unreachable -> expect in testsxackus
2020-11-19Add builtin.Signedness, use it instead of is_signedTadeo Kondrak
2020-11-02std: Fix json utf{8,16} decoding on BE targetsLemonBoy
Byteswap some values when LE ordering is required.
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-07-11run zig fmt on std lib and self hostedVexu
2020-05-24run zig fmt on std libAndrew Kelley
2020-05-12Merge pull request #5118 from xackus/fix-json-writestreamVexu
fix json.WriteStream.emitJson
2020-05-12std.json properly handle comptime int/floatVexu
2020-04-24Add mips support to standard libraryTimon Kruiper
2020-04-23fix json.WriteStream.emitJsonxackus
2020-04-01std: introduce json.WriteStream.stringifydaurnimator
2020-04-01std: use json.StringifyOptions.Whitespace from json.WriteStreamdaurnimator
2020-04-01std: use json.stringify logic in some json.WriteStream code pathsdaurnimator
2020-03-30std lib API deprecations for the upcoming 0.6.0 releaseAndrew Kelley
See #3811
2020-03-29fix overflow in parseFloatxackus
2020-03-10update standard library to new I/O streams APIAndrew Kelley
2020-03-10(breaking) rework stream abstractionsAndrew Kelley
The main goal here is to make the function pointers comptime, so that we don't have to do the crazy stuff with async function frames. Since InStream, OutStream, and SeekableStream are already generic across error sets, it's not really worse to make them generic across the vtable as well. See #764 for the open issue acknowledging that using generics for these abstractions is a design flaw. See #130 for the efforts to make these abstractions non-generic. This commit also changes the OutStream API so that `write` returns number of bytes written, and `writeAll` is the one that loops until the whole buffer is written.
2020-02-14std: use testing.allocator in testsdaurnimator
2020-02-12Convert a lot of json tests to use testing.allocatorBenjamin Feng
2020-01-07json: disallow overlong and out-of-range UTF-8hryx
Fixes #2379 = Overlong (non-shortest) sequences UTF-8's unique encoding scheme allows for some Unicode codepoints to be represented in multiple ways. For any of these characters, the spec forbids all but the shortest form. These disallowed longer sequences are called "overlong". As an interesting side effect of this rule, the bytes C0 and C1 never appear in valid UTF-8. = Codepoint range UTF-8 disallows representation of codepoints beyond U+10FFFF, which is the highest character which can be encoded in UTF-16. Because a 4-byte sequence is capable of resulting in such characters, they must be explicitly rejected. This rule also has an interesting side effect, which is that bytes F5 to FF never appear. = References Detecting an overlong version of a codepoint could get gnarly, but luckily The Unicode Consortium did the hard work by creating this handy table of valid byte sequences: https://unicode.org/versions/corrigendum1.html I thought this mapped nicely to the parser's state machine, so I rearranged the relevant states to make use of it.
2020-01-06zig fmt and update `extern fn` to `callconv(.C)`Andrew Kelley
2019-12-29Merge pull request #3648 from xackus/json-unescapeAndrew Kelley
breaking: JSON unescape
2019-12-10Replace @typeOf with @TypeOf in all zig sourceRobin Voetter
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-08std.fmt.format: tuple parameter instead of var argsAndrew Kelley
2019-11-11Stricter tests for non-streaming parserxackus
2019-11-11Fix bugs in JSON parserxackus
Make comments into documentation where appropriate
2019-11-11json: surrogate pair supportxackus
test json.Parser with tests used for json.Streaming parser (some don't pass yet)
2019-11-06std.json.Value: added dumpStream(), utilize WriteStream for dump()Sebastian Keller
2019-10-27Added test for 'emitJson'Sebastian Keller
2019-10-27Unified public apiSebastian Keller
2019-10-24Shortened switch statementSebastian Keller
2019-10-24Added 'writeJson' to write_stream.zig:Sebastian Keller
Small addition to make writing a json value easier
2019-10-11merge dumps tool: merging ast nodesAndrew Kelley
-fgenerate-docs is replaced ith -femit-docs -fno-emit-bin is added to prevent outputting binary
2019-10-10miscellaneous improvements to generated docsAndrew Kelley
* introduce std.json.WriteStream API for writing json data to a stream * add WIP tools/merge_anal_dumps.zig for merging multiple semantic analysis dumps into one. See #3028 * add std.json.Array, improves generated docs * add test for `std.process.argsAlloc`, improves test coverage and generated docs
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221