The JSON protocol deals with managed objects whose properties include WSDL-defined data objects, such as configuration objects. Method parameters can also be data objects. Some of these data objects are polymorphic, in the sense that they can inherit from other data objects and can be referenced as the parent type.

The JSON protocol distinguishes the assigned type by adding a _typename property to the JSON serialization. For example, a TaskInfo data object contains a result property that has the XSD type xsd:anyType. The actual type of the assigned value is specified with a _typename property in result.

For example, the following JSON shows how a result data object is returned in the server response and the assigned type is identified by the _typeName property.
"result": {
    "_typeName": "ManagedObjectReference", 
    "_value": {
        "value": "domain-s16", 
        "type": "ComputeResource"
    }
}...

When you use a polymorphic type in a request, you must add a _typename property to identify the assigned type for the server. For example, if you create a PropertyFilter for a request to the PropertyCollector, you might include a TraversalSpec object, which inherits from the SelectSet object. Add the _typename property to distinguish a TraversalSpec value from a SelectSet value:

"traverse_vm_folder": {
   "_typeName": "TraversalSpec", 
   "type": "Folder",
   "path": "childEntity", 
   "skip": false
}

Many properties are defined in the WSDL as inheriting from DynamicData. For that reason, you will use _typeName frequently. A best practice is to add the _typeName property to all objects you create for the JSON API.