I am parsing a JSON object obtained by URLFetchApp.fetch() and need to truncate a string value to a max number of bytes. It seems like some combination of the Google Apps Script Utilities Class and HTTPResponse Class is where I will find the answer, but I can not figure out which methods to use and how to put them together.
{object: {key: 'string'}}
something like:
object.key.string.toBytes().substringAsBytes(0,maxBytes).backToString()
https://developers.google.com/apps-script/reference/utilities
https://developers.google.com/apps-script/reference/url-fetch/http-response