Hi, @Klára Štursová ,
I succeed in reproducing your issue in my end. It seems to be a small issue with the modern experience in SharePoint Online. For now, a fix I found will be like this:
After you insert the JSON code and select tile view, save the view. Things seem to be fine and when you switch back and fort, the view returns to a list view. Then you change it back to tile view. Now you have a Asterisk symbol after your view name. (Now you are here)
Then simply use the "Save view as" button to save this view. No need to change the name, just hit the save button. Then the issue will be fixed. You can try to switch back and forth, and the view with JSON formatting will not get changed any more.