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?
I tried that initially, but it didn't pick up the stuff from `_data` and `_mappings` (in Chrome).