Hello @golu ,
Try something like this:
with open(yaml_file, 'r') as yaml_in, open(json_file, 'a') as definition:
parse_string(yaml_in.read(), data)
json.dump(data, definition, indent=4)....
Hope it helps you. If not you can share your snippet so that I can help you out.