ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / 3-tier architecture / WLanguage functions
  • Deserialization
  • Speed
  • Limitations
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Deserializes a buffer or a character string containing the data from a class, structure, array (including an associative array), queue, stack, list or advanced variable (gglCalendar, for example), as well as their subelements.
Example
// 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 Buffer

// Adds elements into the array
Add(MyArray, "WINDEV")
Add(MyArray, "WEBDEV")
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)
Syntax
Deserialize(<Variable> , <Buffer> , <Parameters>)
<Variable>: Variable type
Structure, class, array, queue, list or stack variable.
  • For a structure or a class, a value must be assigned to this variable.
  • For an array, queue, list or stack, a value is automatically assigned to this variable during deserialization.
The result of the deserialization will be assigned to this variable.
<Buffer>: ANSI 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):
psdBinaryBinary deserialization.
New in SaaS
It is now possible to deserialize a member or JSON variable into binary format.
Note: This feature is only available from WINDEV Suite SaaS 2025 - Update 2. For more details, see Using new features exclusive to WINDEV Suite SaaS 2025.
Java Binary deserialization is not available.
psdBinaryFormat16Binary deserialization compatible with version 16.
This format must be used if an application in version 17 or later must share data with an application in version 16 or earlier.
This format must not be used in Unicode mode.
Java Binary deserialization is not available.
psdJSONDeserialization in JSON format.
Java JSON deserialization is not available.
psdXMLXML deserialization with reference to sub-objects.
Reminder: This type of serialization/deserialization allows you to use XML for storing and exchanging data in applications written in WLanguage.
psdXMLAggregatedXML deserialization with direct aggregation of sub-objects.
Note: The psdXMLAggregated serialization mode allows you to easily generate a standard XML file to exchange data with other systems. The psdXMLAggregated deserialization mode is available. However, the WLanguage elements (variants, arrays, derived classes, etc.) will be different from the original elements.
Java This deserialization mode is not available.
New in version 2025
psdXMLArrayRepeatedElements
XML deserialization mode for handling arrays as a sequence of elements.
Note: This constant must be used in combination with the psdXMLAggregated constant.
Java This serialization mode is not available.
Note: This constant is only available from version 2025 Update 1.
Remarks

Deserialization

The deserialization of a variable of type Array, Queue or Stack deletes the contents of the element.
If there are additional members in the structure or class:
  • if a structure or a class is deserialized, additional members keep their values from before the deserialization.
  • if an array of structures or classes is deserialized, additional members take the default value of the member type.
If there are additional members in the serialized buffer, they are ignored during deserialization.
To deserialize an untyped dynamic array, it must first be allocated memory
To deserialize a class or structure containing an untyped dynamic array, it must first be allocated memory.
The wd300xml.dll or wp300xml.dll library is necessesary to deserialize an XML document.
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 vice versa.
In advanced variables:
  • read-only properties are generally not deserializable.
  • write-only properties are generally not serializable.
Special cases are specified in the documentation for each type.
Java For the serialization format to be compatible between WINDEV applications and WINDEV applications for Java, the names of the following serialized elements must not contain special or accented characters:
  • classes,
  • arrays of classes,
  • structures,
  • array of structures.

Speed

Binary deserialization is faster than XML deserialization.

Limitations

  • Fixed and associative arrays of local structures cannot be deserialized.
  • Global members of classes are not serialized/deserialized.
  • The XML serialization/deserialization of an array of structures with a string member containing "\0" or Charact(0) returns the following error: "Wrong serialization format". In this case, a binary serialization/deserialization is required.
  • You cannot serialize/deserialize an array of classes or structures if they contain an untyped dynamic array. It is necessary to use a typed dynamic array in the class or structure.
  • To serialize/deserialize a class, you need a constructor with no mandatory parameters.
  • Java You cannot serialize/deserialize Queue, Stack or List variables.
  • Only JSON serialization is available for Record variables. No deserialization is possible.
  • Error handling: Deserialize does not return an error code. If an error occurs, the ErrorOccurred variable is set to True.
Related Examples:
The Serialize/Deserialize functions Unit examples (WEBDEV): The Serialize/Deserialize functions
[ + ] This example explains how to use the WLanguage functions Serialize and Deserialize.
The serialization consists in saving a variable, an object, a structure, an array or any other element in a buffer. Then, this buffer can be saved on disk or sent by socket. This allows for the persistence of objects.
The Deserialize function is used to rebuild an object, an array or a structure from a buffer.
The Serialize/Deserialize functions Unit examples (WINDEV): The Serialize/Deserialize functions
[ + ] Using the WLanguage Serialize and Deserialize functions
The serialization consists in saving a variable, an object, a structure, an array or any other element in a buffer. Then, this buffer can be saved on disk or sent by socket. This allows for the persistence of objects.
The Deserialize function is used to rebuild an object, an array or a structure from a buffer.
Business / UI classification: Neutral code
Component: wd300vm.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/21/2025

Send a report | Local help