Introduce a test for file's existence:
[ -f test.json ] || echo "{}" > test.json
[ -f test.json ] will check if the file exists and is a regular file. If the file does not exists (||), echo "{}" > test.json will be run.
[ -f test.json ]
||
echo "{}" > test.json
echo '{}' >> test.json
Double arrow will append instead of overwriting the file.
Or if you mean to check file non existence before creation
if [ ! -f test.json ]; then echo "{}" > test.jsonfi