Converting from Json String to IDocumentData

Hello,
I am using the document understanding to get data back from a scanned po. What I want to do is create a queue item which will create an task for a human to validate the document. Currently I am Serializing the document data from the scanner into a json string to put in the queue specific content part. In the process (a whole different bot) when I try to deserialize the json back into the IDocumentData object. I am getting this error Assign: Could not create an instance of type UiPath.IntelligentOCR.StudioWeb.Activities.DataExtraction.IDocumentData`1[UiPath.IntelligentOCR.StudioWeb.Activities.SWEntities.ExtendedExtractionResultsForDocumentData.POAcknowledgmentPurchaseOrdersV5.Bundle.POAcknowledgmentPurchaseOrdersV5]. Type is an interface or abstract class and cannot be instantiated. Path ‘Data’.

Has anyone been able to deserialize from a queue specific data into a type of object like this before?

Thanks

The error occurs because the JSON deserializer can’t instantiate an interface on its own. A simpler design is to queue a secure reference to the source file, then let the performer run extraction and create the validation task in the same workflow, passing Document Data directly. Alternatively, create the task before handing off and queue its identifier. Test the change with one document; re-extraction may incur additional processing cost.

Not sure why the guy above decided to necro this thread, guess you gotta get the post count up for AI replies somewhere…

For an answer written by a human, its not about the interface per say, even if you try to deserialize to a concrete type it won’t work, the DocumentData object is pretty hard to work with.

You have to basically build a new one based on different parts of the data, reconstructing things like the DOM and the extracted values separately.

Its not really worth the effort to be honest. I have done it though, so it is possible.