From: Brendan Hansen Date: Mon, 19 Feb 2024 15:17:16 +0000 (-0600) Subject: added: decoding json into dynamic array X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=efbd28abc46dad3952cb77ebcce01084e0facb24;p=onyx.git added: decoding json into dynamic array --- diff --git a/core/encoding/json/encoder.onyx b/core/encoding/json/encoder.onyx index db02f401..df7630ff 100644 --- a/core/encoding/json/encoder.onyx +++ b/core/encoding/json/encoder.onyx @@ -433,6 +433,18 @@ as_any :: (value: Value, type: type_expr, out: rawptr) { } } + case .Dynamic_Array { + s := cast(^core.array.Untyped_Array) out; + if s.count == 0 { + to_copy := value->as_array(); + + s.allocator = context.allocator; + s.capacity = to_copy.count; + } + + fallthrough; + } + case .Slice { // Strings are handled differently if type == str {