Added unit tests for JSON serialization of primitive and complex types, attendant bug fixes for issues encountered during testing.