I'm using Scott Klement's port of YAJL to parse JSON I'm receiving in a response from a web service. It works great, except I'm having trouble with one of the objects. The service sends a PDF document as a base64-encoded string. The document is typically 450-500KB, and the maximum field size in RPG (relevant to the return value of yajl_get_string()) is 64K, so when I try to pull the base64 string out of the JSON node and write it to a temporary text file (in preparation for decoding it from base64), the target file only gets the first 64K of the data. An example of the code I've tried is:
Where pdfNode is the yajl_val pointing to the node containing the long string.
My initial research suggests I should write yajl_val_t.string to the stream file, but this is pretty new territory to me, so I'm mindful of Scott's recommendation not to use that data structure directly from RPG. Can anyone advise as to whether I'm barking up the right tree, or suggest an appropriate solution?
Thanks!
Code:
yajl_save_string_stmf(pdfNode : outFile : errMsg);
My initial research suggests I should write yajl_val_t.string to the stream file, but this is pretty new territory to me, so I'm mindful of Scott's recommendation not to use that data structure directly from RPG. Can anyone advise as to whether I'm barking up the right tree, or suggest an appropriate solution?
Thanks!
Comment