JSON.stringify
can be used to pretty print JSON.
Arguments are the JSON object, a replacer function that can be used to override the string translation and a number of spaces that are used to indent the keys.
The scope of a service worker is by default the path it's script is loaded from. Therefore for small apps you almost certainly want the script to be at the root of the url hierarchy.