const std = @import("std");

pub fn jsonGetString(obj: std.json.ObjectMap, key: []const u8) ?[]const u8 {
    const v_opt = obj.get(key);
    if (v_opt == null) {
        return null;
    }
    const v = v_opt.?;
    if (v != .string) {
        return null;
    }
    return v.string;
}

pub fn jsonGetInt(obj: std.json.ObjectMap, key: []const u8) ?i64 {
    const v_opt = obj.get(key);
    if (v_opt == null) {
        return null;
    }
    const v = v_opt.?;
    if (v != .integer) {
        return null;
    }
    return v.integer;
}
