Convert an entity to its JSON representation.
O(n) in entity size; serializes the whole entity on every call.
Convert an entity to its JSON representation.