AWS textract API response to Json file

Hi Experts

I am using AWS API for document analysis as per official uipath documentation.
As per doc , API returns pageDetails type argument is

I wonder how can I direct o/p to json file and same time do “write_line” also .

I am not even able to iterate over this data type.
Error I get when I do for each is : option strict on disallows implicit conversions from to ‘system.collections.ienumerable’