Hey, I’m trying to serialize ScriptConfig objects to the data.bin files that Ignition 8.1 uses for gateway events.
At the top level, this snippet takes the formed object and returns a byte array.
    public static byte [] serialize(JsonNode root){
        XMLSerializer xmlSerializer = new XMLSerializer();
        xmlSerializer.initDefaults();
        //Root Attributes
        ScriptConfigSerializer.addRootAttributes(root, xmlSerializer);
        //Script Config
        ScriptConfig scriptConfig = ScriptConfigSerializer.serializeScriptConfig(root);
        try {
            return xmlSerializer.serializeBinary(scriptConfig, true);
        } catch (SerializationException e) {
            throw new RuntimeException(e);
        }
    }
When I write this to the filesystem, Ignition gives me the following error:
SerializationException: Unexpected parsing error during XML deserialization.
caused by org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
Also, when I try to deserialize the output file, I get this error that the data is not binary encoded serialized data.
Exception in thread "main" java.lang.RuntimeException: com.inductiveautomation.ignition.common.xmlserialization.SerializationException: Data is not binary encoded serialized data. magic number is wrong.
I looked into possibly adding a SerializationDelegatebut it didn’t seem like any of them were the correct type.
Any help would be greatly appreciated!