DeserializeAVRO

Description

Converts an Avro string data representation into CFML data, such as a CFML structure or array.

Returns

The data value in ColdFusion format: a structure, array, query, or simple value.

Syntax

deserializeAVRO(data, readerSchema, strictMapping, useCustomSerialization)

Parameters

Parameter Required Description
data Yes A ColdFusion data value or variable that represents one.
readerSchema Yes Schema passed as a text string or absolute filepath.
strictMapping No

A Boolean value that specifies whether to convert the AVRO strictly, as follows:

  • true: (Default) Convert the Avro binary to ColdFusion data type.
  • false: Determine if the binary data contains representation of a ColdFusion query, and if so,  deserialize the data into a query.
useCustomSerialization
No True/false. Whether to use the customSerializer or not. The default value is true. Note that the custom serialize will always be used for serialization. If false, the Avro serialization will be done using the default ColdFusion behavior.

Example

<cfscript>
    // define the Avro schema
    mySchema=   '{  
                    "namespace": "first.example",
                    "type": "record",
                    "name": "User",
                    "fields": [
                        {"name": "name", "type": "string"},
                        {"name": "favorite_number",  "type": ["int"]},
                        {"name": "favorite_color", "type": ["string"]}
                    ]
                }'
    // set the data that conforms the schema above
    data= {
            "name":"Jack Sparrow",
            "favorite_number":{"int":9},
            "favorite_color":{"string":"red"}
        }
 
    avroSerializeResponse = serializeAVRO(data, mySchema)
writedump(avroSerializeResponse) 
avroDeSerializeResponse = deSerializeAVRO(avroSerializeResponse, mySchema, true, false)
writedump(avroDeSerializeResponse)
</cfscript>

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online