Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pyVmomi/VmomiJSONEncoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

from . import Iso8601
from .VmomiSupport import ManagedObject, DataObject, ManagedMethod, \
UnknownManagedMethod, GetWsdlType, XMLNS_VMODL_BASE, binary
UnknownManagedMethod, GetWsdlType, XMLNS_VMODL_BASE, binary, \
GetVmodlType


class VmomiJSONEncoder(json.JSONEncoder):
Expand Down Expand Up @@ -82,7 +83,10 @@ def default(self, obj): # pylint: disable=method-hidden
obj._moId)
result['_vimtype'] = obj.__class__.__name__
for prop in obj._GetPropertyList():
result[prop.name] = getattr(obj, prop.name)
try:
result[prop.name] = getattr(obj, prop.name)
except GetVmodlType("vmodl.fault.MethodNotFound"):
pass
return self._remove_empty_dynamic_if(result)
return str(obj).strip("'") # see VmomiSupport.FormatObject
if isinstance(obj, DataObject):
Expand Down