Nested data structures

Added support for nested data structures and included working examples from the spec. 

Minor changes:
- For attributes should refer to 'id' not class.
- We should check for console before outputting to it.