From efbd28abc46dad3952cb77ebcce01084e0facb24 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Mon, 19 Feb 2024 09:17:16 -0600 Subject: [PATCH] added: decoding json into dynamic array --- core/encoding/json/encoder.onyx | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 { -- 2.25.1