Parsing JSON Text
Standard JSON syntax can include the type of the objects to create; for example:
/> "__type":"Customer", .in Microsoft JSON format
/> "$type":"Customer", .in NewtonSoft (JSONN) format
This "__type" special type tag must appear as the first entry following the { or [ symbol that begins the object contents description in Microsoft format. In NewtonSoft, the "$type" tag can appear after the object reference tag; for example:
"id":"12", "$type::"Customer",
In NewtonSoft, the type can also include a namespace such as "MyNameSpace.Customer", which JADE will ignore.
If the JSON does not include the type tag, the type of the object is assumed to be the implied type of the expected object; for example, the type of the method parameter to be populated or the type of the property reference.
If the JSON includes the type tag, the type must be the implied type or a subclass of the implied type. If it is not, an exception is generated.
When creating JSON from an object using the JadeJson class, the type tag is inserted only when the class is not specified; that is, these tags are output only when the object is a subclass of the specified type. For example, if a reference property is defined to be a Customer and the reference is to a subclass SpecialCustomer, the tag is inserted. Similarly, if a collection is encoded to JSON and a member of the collection is a subclass of the membership type, the tag is inserted.