pass json data to trains object