Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Size limit for JSON and XML parsing?

brycegodfrey
Kilo Contributor

I'm trying to parse a large body of data, and have been unable to do it using JSON.parse or XmlDocument2 due to its large size.

Javascript compiler exception: WrappedException of java.io.UTFDataFormatException: encoded string too long: 278472 bytes in: ....

Is there a system setting I can use to turn this up or another API to get around this limitation?   I'm on Fuji patch 8

13 REPLIES 13

Valor1
Giga Guru

Have you tried both of the following?


Option 1 (uses JavaScript):


var json = new JSON();


var jsObj = json.decode(stringValue);



Option 2 (uses Java):


var json = new JSONParser();


var jsObj = json.parse(stringValue);


Yeah, just tried both those and get the same error.


Where are you getting the JSON text from?


200KB+ is a lot of data..


I'm having the same issue here. The data is coming in from our asset management tool through a SOAP call. The payload field (in the ECC Queue) is a special field designated to allow massive amounts of data. However, as I'm getting back ~60mb worth of data, any attempts to parse or manipulate the response/payload data ends up in errors:



Like when trying to create a new XMLDocument(soap_response):


Problem when trying to get a Rhino object: java.lang.RuntimeException: String object has exceeded max size of 16777216: org.mozilla.javascript.ScriptableObject.examineSize(ScriptableObject.java:2173)


Or when trying to convert the response to a JSON object:


java.lang.RuntimeException: String object has exceeded max size of 16777216

All of the data is in ServiceNow (and in less than 30 seconds), but it seems that I don't have any way of manipulating it.



I have a HI ticket open, but has anyone seen this before and have a solution? (Besides limiting my SOAP return!)