get values from javascript objects by specifying a path