Updated test case to use mocks for testing
Fixed list-handling in JsonEncoder

The JsonEncoder did not correctly encode lists which contained entities
or nested lists.