Xcode freezes (and crashes) when clicking on a JSON file in the Project Navigator

Viewed 557

I have a very basic project set up with 3 json files for Lottie animations, but when I click on one of them in my Project Navigator, Xcode will freeze and eventually become unresponsive. The json file is not big in size either (160 KB). I wonder what's the cause behind this freezing. Is it a bug in Xcode right now or are you not meant to see your json files other than in "quick view" mode? I'm running Xcode 12.5.

2 Answers

This could happen with "minified" JSON (i.e. on a single line, as opposed to "pretty printed" with line returns and tabs/spaces): the longer the JSON, the longer the single line and some editors might have a hard time rendering it.

You could "pretty print" your JSON (outside of Xcode) to make it more digestible to the editor but be aware that this might result in significantly bigger (10x) JSON files.

I have the same problem. i tried this: My json file consisting of 612 different objects blocks Xcode. So I realized that the problem was that the objects were greater than 599. If I delete 13 objects, everything works fine.

Related