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.
dev
Louis Pearson 2022-08-03 16:35:51 -06:00
parent 765ad5f8a7
commit 17e6e71e8b
1 changed files with 2 additions and 2 deletions

View File

@ -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,