You want getfield(foo, fname)
For more info:
help?> getfield
search: getfield
getfield(value, name::Symbol)
Extract a named field from a value of composite type. The syntax a.b calls getfield(a, :b).
julia> a = 1//2
1//2
julia> getfield(a, :num)
1