Gzip Json Data

Compression Steps

  1. Create json array for payment request records e.g. [{"SiteCode": "EXA-SIT-001", "Amount": 5.21, "TransactionReference": "ID001"},{"SiteCode": "EXA-SIT-001", "Amount": 1050, "TransactionReference": "ID002"}]
  2. Convert json string to UTF8 byte array
  3. Compress byte array using Gzip format
  4. Convert compressed byte array to a Base64 string

Decompression Steps

  1. Convert Base64 string to a byte array
  2. Decompress bytes using Gzip format
  3. Convert bytes to UTF8 encoded string
  4. Result should be json string with request fields and results e.g. [{"SiteCode": "EXA-SIT-001", "Amount": 5.21, "TransactionReference": "ID001", "PaymentLink": "https://p.ozow.com/123456", "Errors": "", "SentUTC": null},{"SiteCode": "EXA-SIT-001", "Amount": 1050, "TransactionReference": "ID002", "PaymentLink": "https://p.ozow.com/789012", "Errors": "Invalid mobile number", "SentUTC": null},{"SiteCode": "EXA-SIT-001", "Amount": 175.20, "TransactionReference": "ID003", "RecipientAddress": "0831231234", "PaymentLink": "https://p.ozow.com/456987", "Errors": null, "SentUTC": "2020-07-20 10:01:52"}]