Hello Dojo,
I'm currently working on a package to install a solution to a DataMiner agent, as part of this process, I want to create/update a DOM Module that I've already configured on one system, and I figured that using the exported json file from the DOM Editor script would be the best way to go forward. The question I have is that I'd like to know if there is a pre-existing object for deserializing these files. I checked the DOM Editor script to see if it uses one, and it doesn't use on. I'm not above creating an object to parse it, but I figure I should ask to make sure I'm not about to reinvent the wheel.
Thank you for your help,
Bauti
Hi Bautista,
The safest way would be to generate your own exports using the same class structure as you used to import them. This ensures that the packages are and remain compatible, since you control the format/contract. I would however expect the format of the DOM editor to not really change in any breaking way, so it is probably safe to use the class you currently have.
The DOM editor just exports the DOM data in one of the many possible ways, and does not really specify 'the' way of doing so. There are other perfectly valid ways to create your own exports where the objects are each in separate files, for example. That approach could be better if you have a very large model with many 'default' DOM instances.
For the time being, I'm using this class for deserializing Modules:
Somethings to know is that if you use this class, you're going to need to set your JsonSerializerSettings to have TypeNameHandling.Auto and a ContractResolver with IgnoreSerializableInterface set to true. You also can't use this with SecureNewtonsoftDeserialization as that will throw an error, so stick to JsonConvert.