Add support for JSON.stringify to ComponentData

I suppose this is a sort of regression corner-case. The workaround seems to be to add a `JSON.stringify`-friendly `toJSON` method to `ComponentData` that serializes its view of itself. See #1548

Is this the correct solution?