extract to json and create def from json