In french: Désérialise
Deserializes a buffer or a character string containing the data of a class, structure, array (including an associative array), queue, stack, list or advanced variable (gglCalendar
for example) as well as their sub-elements.
// This example explains how to use the Serialize/Deserialize functions
// with an Array variable.
// These functions can use all types of WLanguage variables.
MyArray is array of strings
bufResult is a Buffer
// Adds elements into the array
Add(MyArray, "WINDEV MOBILE")
// Serialize the array in the buffer in JSON
// => Save the array and its entire content in a JSON string
Serialize(MyArray, bufResult, psdJSON)
// Deserialize the JSON buffer
// => Rebuild the WLanguage array from the JSON string
MyRebuiltArray is array of strings
Deserialize(MyRebuiltArray, bufResult, psdJSON)
Deserialize(<Variable> , <Buffer> , <Parameters>)
<Variable>: Type of variable
Structure, class, array, queue, list or stack variable.
- For a structure or a class, this variable must be allocated.
- For an array, a queue, a list or a stack, this variable is automatically allocated during the deserialization.
The deserialization will be performed in this variable.
<Buffer>: Ansi character string or buffer
Variable that contains the serialized data. A variable name must be specified.
<Parameters>: Integer constant
Type of deserialization (must correspond to the type chosen for the serialization):
The deserialization of an array, a queue or a stack deletes the content of the element.
If additional members are found in the structure or in the class:
- if a structure or a class is deserialized: the additional members keep the value they had before the deserialization.
- if an array of structure or class is deserialized: the additional members take the default value of the member type.
If additional members are found in the serialized buffer, they are ignored during the deserialization.
To deserialize an untyped dynamic array, this array must be allocated beforehand.
To deserialize a class or a structure containing an untyped dynamic array, this array must be allocated beforehand.
The XML deserialization requires the wdxxxxml.dll or wpxxxxml.dll library.
An advanced variable that was serialized with a French version of the product (and whose names and properties are in French in the serialization buffer) can be deserialized by an English version of the product (and conversely).
In the advanced variables:
- the read-only properties cannot usually be deserialized.
- the write-only properties cannot usually be serialized.
Special cases are noted in the documentation for each type.
The names of the following serialized elements must contain no special character and no accented character:
- arrays of classes,
- array of structures.
The binary deserialization is faster than the XML deserialization.
Unit examples (WEBDEV): The Serialize/Deserialize functions
Unit examples (WINDEV): The Serialize/Deserialize functions
This page is also available for…
Click [Add] to post a comment