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



1 Like

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