How to handle an empty json file

when loading data from json file if the json file is empty the program is showin error then how check before hand that json file contains data or not

2 Likes

@dsedyoda
@parkar-ta-ds

1 Like

@milindyadav98
You can use exception handling concept i.e.
Try and except block.
And in except block handle the error ‘JSONEncoder’ for empty json file.

1 Like