There are few third party libraries which can be used to perform this task however they involve some cost however best way here is to use an SAP Connector.
SAP Connectors are available for almost all prevalent programming languages like JAVA, C#, Python. You can program against these connectors and read data from IDoc. You can do a lot many things with these connectors from reading data to convert them to flat files for further usage.
I have used JAVA connector for a similar scenario. You can use SAP Java IDoc class library and SAP JCO libraries for parsing IDoc files.
The SAP Java IDoc Class Library comprises of two components
The SAP Java-based IDoc Class Library provides an easy to use API for reading, updating and navigating IDocs. This library is middleware independent. But in order to create, send and receive IDocs relies on middleware. You can use the SAP Java Connector IDoc Class Library for the same. Both of these libraries are well documented with examples.