From 17e6e71e8b16dd8ba8a235a455bff7b743b60a17 Mon Sep 17 00:00:00 2001 From: Louis Pearson Date: Wed, 3 Aug 2022 16:35:51 -0600 Subject: [PATCH] Change __value to std.json.Value There's no way to know what type of value I will get for __value, so this is the only reasonable way to do it. --- src/LDtk.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LDtk.zig b/src/LDtk.zig index 0504707..7e71833 100644 --- a/src/LDtk.zig +++ b/src/LDtk.zig @@ -416,7 +416,7 @@ pub const FieldInstance = struct { // TODO: type and value have many possible values and are not always strings. // Figure out if we can use JSON.parse for this __type: []const u8, - __value: []const u8, + __value: std.json.Value, defUid: i64, pub fn fromJSON(field_value: ?std.json.Value) !?FieldInstance { @@ -424,7 +424,7 @@ pub const FieldInstance = struct { const __identifier = string(field.get("__identifier")) orelse return error.InvalidIdentifier; const __tile = try TilesetRectangle.fromJSON(field.get("__tile")); const __type = string(field.get("__type")) orelse return error.InvalidType; - const __value = string(field.get("__value")) orelse return error.InvalidValue; + const __value = field.get("__value") orelse return error.InvalidValue; const defUid = integer(field.get("defUid")) orelse return error.InvalidIDefUid; return FieldInstance{ .__identifier = __identifier,