Einhugur JSON II Serialization Framework for Xojo

JSONSerializerII.DeSerialize Method

De-serialize's a class structure

DeSerialize(
   item as Object,
   rootName as String,
   jsonDoc as JSONObject)

Parameters

item
The object to de-serialize into
rootName
Name of the root. This can be empty string if package root is not named.
jsonDoc
The json document to be de-serialized.

Remarks

All classes that are de-serialized must have a default constructor that has no parameters.

In this example here we needed to add Customer and Address as known types as they were serialized as Polymorphic objects instead of strongly typed.


s = new JSONSerializationII.JSONSerializerII()
s.AddKnownClass(GetTypeInfo(Customer))
s.AddKnownClass(GetTypeInfo(Address))

Dim deserializedFacility as Facility = new Facility()

s.DeSerialize(deserializedFacility,"Facility”,jsonDoc)



This method can throw SerializationException.

See Also

JSONSerializerII Class