Parsing a complex flat file

Hello,

I have a requirement to parse a content seen below to a IS document type, it appears to a complex flat file with lot of delimiters. Need assistance on what delimiters do we make use of in flat file schema to parse this content.


[{“day”:“2016/06/13”,“machineShifts”:{“001_10”:[{“id”:4063370,“factory_fk”:1,“shift”:“Morning”,“person”:“x”,“week”:201624,“day”:“2016/06/13”,“machinename”:“001_10”,“color”:null,“noHours”:8},{“id”:4063371,“factory_fk”:1,“shift”:“Evening”,“person”:“x”,“week”:201624,“day”:“2016/06/13”,“machinename”:“001_10”,“color”:null,“noHours”:8},{“id”:4063372,“factory_fk”:1,“shift”:“Night”,“person”:“x”,“week”:201624,“day”:“2016/06/13”,“machinename”:“001_10”,“color”:null,“noHours”:8}]“201_10”:[{“id”:4063412,“factory_fk”:1,“shift”:“Morning”,“person”:“x”,“week”:201624,“day”:“2016/06/13”,“machinename”:“201_10”,“color”:null,“noHours”:8},{“id”:4063413,“factory_fk”:1,“shift”:“Evening”,“person”:“x”,“week”:201624,“day”:“2016/06/13”,“machinename”:“201_10”,“color”:null,“noHours”:8},{“id”:4063414,“factory_fk”:1,“shift”:“Night”,“person”:“”,“week”:201624,“day”:“2016/06/13”,“machinename”:“201_10”,“color”:“rgba(0, 0, 0, 0)”,“noHours”:8}]}}]

Thank you.

It looks like a JSON object. you can try to parse it using a Json parser first.

If is a valid json string then you can use the service “pub.json:jsonStringToDocument”. Make sure you have wM 9.0 and above.

Thank you Mahesh & Tong Wang for the reply.

Yes, able to parse successfully using pub.json:jsonStringToDocument in 9x but unfortunately my requirement is in 7x.

Trying to import the source code / class file of this service from 9x->7.3 and try. Any suggestions?

No comments on your approach :slight_smile:

But you can try the code available at webMethods: Handling JSON in the ESB