aboutsummaryrefslogtreecommitdiff
path: root/lib/std/json
AgeCommit message (Collapse)Author
2025-10-30std.debug.lockStderrWriter: also return ttyconfMatthew Lugg
`std.Io.tty.Config.detect` may be an expensive check (e.g. involving syscalls), and doing it every time we need to print isn't really necessary; under normal usage, we can compute the value once and cache it for the whole program's execution. Since anyone outputting to stderr may reasonably want this information (in fact they are very likely to), it makes sense to cache it and return it from `lockStderrWriter`. Call sites who do not need it will experience no significant overhead, and can just ignore the TTY config with a `const w, _` destructure.
2025-09-21Merge pull request #25302 from ziglang/growCapacityAndrew Kelley
std: remove loop from growCapacity
2025-09-20coerce vectors to arrays rather than inline forAndrew Kelley
2025-09-20compiler: require comptime vector indexesAndrew Kelley
2025-09-20std.json: delete test tightly coupled to ArrayList growthAndrew Kelley
This test works by assuming that std.ArrayList will grow with a specific capacity increasing pattern, which is an invalid assumption. Delete the offending test.
2025-09-18add some new fuzz testsKendall Condon
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-08-22std: remove lossy int to float coercion on json parseRaiden1411
2025-08-13std.io.Writer.Allocating: rename getWritten() to written()Isaac Freund
This "get" is useless noise and was copied from FixedBufferWriter. Since this API has not yet landed in a release, now is a good time to make the breaking change to fix this.
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-07-19std.json: update to new I/O APIAndrew Kelley
also do a little bit of namespace cleanup
2025-07-09std: fmt.format to io.Writer.printAndrew Kelley
allows reverting format -> deprecatedFormat, plus I think this is a nicer place for the function.
2025-07-07std.io.Writer.printValue: rework logicAndrew Kelley
Alignment and fill options only apply to numbers. Rework the implementation to mainly branch on the format string rather than the type information. This is more straightforward to maintain and more straightforward for comptime evaluation. Enums support being printed as decimal, hexadecimal, octal, and binary. `formatInteger` is another possible format method that is unconditionally called when the value type is struct and one of the integer-printing format specifiers are used.
2025-07-07std.fmt: fully remove format string from format methodsAndrew Kelley
Introduces `std.fmt.alt` which is a helper for calling alternate format methods besides one named "format".
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-07-07std.io: move getStdIn, getStdOut, getStdErr functions to fs.FileAndrew Kelley
preparing to rearrange std.io namespace into an interface how to upgrade: std.io.getStdIn() -> std.fs.File.stdin() std.io.getStdOut() -> std.fs.File.stdout() std.io.getStdErr() -> std.fs.File.stderr()
2025-07-07std.io: deprecated Reader/Writer; introduce new APIAndrew Kelley
2025-05-13std.meta.intToEnum -> std.enums.fromIntwooster0
Also use an optional as the return type instead of an error code.
2025-03-24std.mem.bytesAsSlice: fix to support zero-bytes sized typessamy007
also added a test for json parsing of zero sized type
2025-02-13std.ArrayList: initial capacity based on cache line sizeAndrew Kelley
also std.MultiArrayList
2025-02-10std.ArrayList: popOrNull() -> pop() [v2] (#22720)Meghan Denny
2025-01-16all: update to `std.builtin.Type.{Pointer,Array,StructField}` field renamesmlugg
2025-01-16all: update to `std.builtin.Type.Pointer.Size` field renamesmlugg
This was done by regex substitution with `sed`. I then manually went over the entire diff and fixed any incorrect changes. This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since my regex happened to also trigger here. I opted to leave these changes in, since they *are* a correct migration, even if they're not the one I was trying to do!
2024-09-12Replace deprecated default initializations with decl literalsLinus Groh
2024-09-07Support stringifying non-exhaustive enum to json (#21228)pfg
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-08-22std.json.WriteStream supports streaming long values directly to the ↵Josh Wolfe
underlying stream (#21155)
2024-08-07fix partial strings getting dropped when multi-byte codepoints span input ↵Josh Wolfe
buffers
2024-08-07fix tests actually checking string contentsJosh Wolfe
2024-07-25Add `std.json.ParseOptions.parse_numbers` to preserve float precision (#20744)Eugene-Dash
2024-07-03json: respect duplicate_field_behavior in std.json.Value.jsonParseTechatrix
2024-05-27update the codebase for the new std.Progress APIAndrew Kelley
2024-05-03Delete compile errors for deprecated declsRyan Liptak
2024-04-06json.WriteStream.objectFieldRaw() (#19553)Josh Wolfe
2024-03-09std.json: update tests to match new floating point formattingMarc Tiehuis
2024-02-26Remove redundant test name prefixes now that test names are fully qualifiedRyan Liptak
Follow up to #19079, which made test names fully qualified. This fixes tests that now-redundant information in their test names. For example here's a fully qualified test name before the changes in this commit: "priority_queue.test.std.PriorityQueue: shrinkAndFree" and the same test's name after the changes in this commit: "priority_queue.test.shrinkAndFree"
2024-02-20json: make std.json.stringifyAlloc return a mutable slice (#19013)Techatrix
2024-01-13Revert "Merge pull request #18410 from dweiller/by-length-slice-bug"Andrew Kelley
This reverts commit d9d840a33ac8abb0e616de862f592821a7f4a35e, reversing changes made to a04d4330945565b8d6f298ace993f6954c42d0f3. This is not an adequate implementation of the missing safety check, as evidenced by the changes to std.json that are reverted in this commit. Reopens #18382 Closes #18510
2024-01-09AstGen: add error for redundant comptime var in comptime scope (#18242)Bogdan Romanyuk
2024-01-03Remove some `@as` coercions from assertionsCarl Åstholm
These are some spurious fixes to help illustrate the improved ergonomics of the `expectEqual` change. It is by no means complete.
2023-12-31prevent by-length slice compile error in static json parsingdweiller
2023-12-28refact: rectifified a typo in docs of stringify.zigMarcius
2023-11-22std: remove meta.traitAndrew Kelley
In general, I don't like the idea of std.meta.trait, and so I am providing some guidance by deleting the entire namespace from the standard library and compiler codebase. My main criticism is that it's overcomplicated machinery that bloats compile times and is ultimately unnecessary given the existence of Zig's strong type system and reference traces. Users who want this can create a third party package that provides this functionality. closes #18051
2023-11-19lib: correct unnecessary uses of 'var'mlugg
2023-11-09std.math: Add isPositiveZero() and isNegativeZero()Linus Groh
2023-10-27x86_64: fix c abi test failuresJacob Young
2023-10-27std.json: Parse -0 as a float instead of an integer (#17729)Linus Groh
This is consistent with `JSON.parse("-0")` in JavaScript, RFC 8259 doesn't specifically mention what to do in this case. If a negative zero is encoded the intention is likely to preserve the sign.
2023-10-26x86_64: fix behavior of `getValue`Jacob Young
Old behavior renamed to `getValueIfFree`.
2023-10-25x86_64: pass more testsJacob Young
* 128-bit integer multiplication with overflow * more instruction encodings used by std inline asm * implement the `try_ptr` air instruction * follow correct stack frame abi * enable full panic handler * enable stack traces
2023-10-23x86_64: implement enough to pass unicode testsJacob Young
* implement vector comparison * implement reduce for bool vectors * fix `@memcpy` bug * enable passing std tests