Speaking of viewers, web browsers come with their own profile viewers. Maybe you could simply piggyback on these.
For Chrome this happens at the chrome://tracing address and the JSON file format it can read is described here.
For Firefox it's in the browser's webdeveloper performance tools or here. The format seems to be a little bit less well documented but some type defintions can be found here.