code: def generate_annotations_json(source_path, target_path, only_simple=False):
      # type: (str, str, bool) -> None
      
      results = generate_annotations_json_string(source_path, only_simple=only_simple)
      with open(target_path, 'w') as f:
          json.dump(results, f, sort_keys=True, indent=4)
docs: Like generate_annotations_json_string() but writes JSON to a file.