Sets metadata for items of an array. Useful when using serializeJSON with ambiguous data.
arraySetMetadata(array, metadata)
→ returns void
someArray.setMetadata(metadata)
Outputs serialized JSON for an array containing various data types
inputs = ["2016.02", 42.0, "Yes", "No", "32830", {"t1": "Yes"}, ["1","yes","3",false,"null","null"]];
metadata = {items: ["numeric", "integer", "string", "boolean", "string", {t1: {type:"string",ignore:true}}, {items: ["integer","boolean","string","string","string","null"]}]};
arraySetMetadata(inputs,metadata);
writeOutput(serializeJSON(inputs));
Expected Result: [2016.02,42.0,"Yes",false,"32830",{},[1,true,"3","false","null","null"]]
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.