Changed the serializer to return a proper JSON tree that can be directly
inspected via javascript
Changes to serializer to make valid JSON strings when non-array elements
present