parses and builds the json file correctly