Like generate_annotations_json_string() but writes JSON to a file.
(source_path, target_path, only_simple=False)
| 71 | |
| 72 | |
| 73 | def generate_annotations_json(source_path, target_path, only_simple=False): |
| 74 | # type: (str, str, bool) -> None |
| 75 | """Like generate_annotations_json_string() but writes JSON to a file.""" |
| 76 | results = generate_annotations_json_string(source_path, only_simple=only_simple) |
| 77 | with open(target_path, 'w') as f: |
| 78 | json.dump(results, f, sort_keys=True, indent=4) |