deserializeAvro

Converts an Avro data representation into CFML data.

deserializeAvro(data, readerSchema [, strictMapping, useCustomSerialization]) → returns any

This function requires Adobe ColdFusion 2023 and up.  Not supported on Lucee, etc.

Argument Reference

data any
Required

Avro serialized data

readerSchema string
Required

The Avro schema as a string or the absolute path to the schema

strictMapping boolean
Default: true

Specifies whether to convert the Avro strictly. If true, converts the Avro binary to matching ColdFusion data types.

useCustomSerialization boolean
Default: true

Whether to use the customSerializer

Links more information about deserializeAvro

Examples
Sample code invoking the deserializeAvro function

news = queryNew("id,title",
    "integer,varchar",
    [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]);
newsSchema = '{  
    "namespace": "my.example",
    "type": "record",
    "name": "News",
    "fields": [ {"name":"id","type":"int"}, {"name":"title","type":"string"} ]
}';
avro = serializeAvro(news, newsSchema);
writeDump(deserializeAvro(avro, newsSchema));

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub