The Serializer object can be used to serialize properties of the source object. This can be used to replicate a object in a variant map or human readable in a JSON format.


Be carefully when mode is set to Serializer.SerializeOnChange. This can update data multiple times. For example updating the data property of an DataObject will also update its timestamp and hence serialize twice. This is also noted in the example at the bottom. If this behaviour is a problem for your application use Serializer.SerializeManually and connect update() to a unique signal.

› Inherits:Object



This property holds the output of the serialization.

› Type:Variant
› Signal:dataChanged()
› Attributes:Writable


This property holds a list of source property names as strings which should not be serialized.

› Type:StringList
› Signal:excludedPropertiesChanged()
› Attributes:Writable


This property holds the format which is used for the serialization.

› Type:Format
› Default:Serializer.CompactJsonString
› Signal:formatChanged()
› Attributes:Writable


This property holds the interval of the periodically serialization. This property does not have a effect when mode is not set to Serializer.SerializePeriodically.

› Type:SignedInteger
› Default:0
› Signal:intervalChanged()
› Attributes:Writable


This property holds the mode which defined the moment when the source should be serialized.

› Type:Mode
› Default:Serializer.SerializeManually
› Signal:modeChanged()
› Attributes:Writable


This property holds the object which should be serialized.

› Type:Object
› Signal:sourceChanged()
› Attributes:Writable



This method updates data with the serialized duplicate of source.



This enumeration describes which format should be used to output the serialized data.

Name Value Description
Serializer.IndentedJsonString 0 defines human readable output with indention and line breaks after each key value pair.
Serializer.CompactJsonString 1 defines human readable output in one line without spaces.
Serializer.Native 2 the data is left unformatted as a map.


This enumeration describes all available modes when the source object should be serialized.

Name Value Description
Serializer.SerializeManually 0 serialize only when update() is called.
Serializer.SerializePeriodically 1 serialize periodically with the given interval.
Serializer.SerializeOnChange 2 serialize properties whenever a property was changed.


import InCore.Foundation 2.5

Application {

    // counts uptime in seconds
    Counter {
        // default interval is 1 s
        id: counter
        increment: 1
        startValue: 0

    // measurement to display uptime
    MeasurementGroup {
        id: measurementGroup
        Measurement {
            id: measurement
            data: counter.value
            name: "uptime"

    // pack data to a string
    Serializer {
        source: measurementGroup
        mode: Serializer.SerializeOnChange
        format: Serializer.CompactJsonString
        excludedProperties: ["displayString", "siPrefix"]
        onDataChanged: console.log( "serialized data changed", data )