Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Integration Server Built-In Services | JSON Folder | Summary of Elements in This Folder | pub.json:jsonStreamToDocument
 
pub.json:jsonStreamToDocument
WmPublic. Converts content from the JSON content stream to a document (an IData object). This service loads the whole JSON data into memory and then converts to an IData object.
Input Parameters
jsonStream
Object. JSON content in an input stream to convert to a document (an IData object).
decodeRealAsDouble
String. Optional. Converts real numbers from jsonStream to either a Float or Double Java wrapper type. Set to:
*true to convert real numbers to Double Java wrapper types. This is the default.
*false to convert real numbers to Float Java wrapper types.
Note:
The decodeRealAsDouble parameter overrides the value specified by the watt.server.json.decodeRealAsDouble server configuration parameter. If no value is supplied for decodeRealAsDouble, Integration Server uses the value set in watt.server.json.decodeRealAsDouble. For more information about watt.server.json.decodeRealAsDouble, see webMethods Integration Server Administrator’s Guide.
decodeRealAsString
String. Optional. Converts real numbers in the jsonStream to String. Set to:
*true to convert real numbers to String.
*false to not convert real numbers to String. The real numbers are then converted to either Float or Double Java wrapper type depending on the value specified in decodeRealAsDouble. This is the default.
Note:
The decodeRealAsString parameter overrides the value specified by the watt.server.json.decodeRealAsString server configuration parameter. If no value is supplied for decodeRealAsString, Integration Server uses the value set in watt.server.json.decodeRealAsString. For more information about watt.server.json.decodeRealAsString, see webMethods Integration Server Administrator’s Guide.
decodeIntegerAsLong
String. Optional. Converts integers from jsonStream to either a Long or Integer Java wrapper type. Set to:
*true to convert integers to Long Java wrapper types. This is the default.
*false to convert integers to Integer Java wrapper types.
Note:
The decodeIntegerAsLong parameter overrides the value specified by the watt.server.json.decodeIntegerAsLong server configuration parameter. If no value is supplied for decodeIntegerAsLong, Integration Server uses the value specified in the watt.server.json.decodeIntegerAsLong property. For more information about watt.server.json.decodeIntegerAsLong, see webMethods Integration Server Administrator’s Guide.
decodeNullRootAsEmpty
String. Optional. Converts a null value that Integration Server retrieves from JSON content to either IData or empty IData. Set to:
*true to convert the null value to empty IData. The subsequent encoding of empty IData creates a JSON text of “{}”. This JSON content is different from the original JSON content (null) as the original null value gets converted to JSON text of "{}".
*false to convert the null value to IData. This is the default.
unescapeSpecialChars
String. Optional. Controls whether Integration Server unescapes the special characters '\n', '\r', '\t', '\b', '\f', '\\', '\"' while parsing JSON documents. Set to:
*true to unescape these special characters (that is, '\n' will be replaced with new line, similarly other characters will also be replaced) in the output document. This is the default.
*false to keep these characters as is in the output document.
Note:
The unescapeSpecialChars parameter overrides the value specified by the watt.server.json.decode.unescapeSpecialChars server configuration parameter. If no value is supplied for unescapeSpecialChars, Integration Server uses the value specified in the watt.server.json.decode.unescapeSpecialChars parameter. For more information about watt.server.json.decode.unescapeSpecialChars, see webMethods Integration Server Administrator’s Guide.
Output Parameters
document
Document Document (IData object) resulting from the conversion of jsonStream.
Usage Notes
If watt.server.http.jsonFormat is set to stream, Integration Server places a jsonStream variable in the pipeline when it receives an HTTP request containing JSON content. You can then use pub.json:jsonStreamToDocument to parse jsonStream into pipeline variables. If watt.server.http.jsonFormat is set to parsed, which is the default, the JSON content handler parses the JSON content in the HTTP request automatically. In this case, the pub.json:jsonStreamToDocument does not need to be invoked. For more information about watt.server.http.jsonFormat, see webMethods Integration Server Administrator’s Guide.
A JSON text may contain only an unnamed array. When parsing such a JSON text with pub.json:jsonStreamToDocument, Integration Server uses a fixed name of $rootArray for the array value. The $rootArray field appears in the document output parameter.
The JSON standard requires that field names be enclosed in double quotes. However, when parsing legacy JavaScript as JSON text it may be helpful to allow unquoted field names as JavaScript does not require field names to be enclosed in double quotes. The server configuration parameter watt.server.json.allowUnquotedFieldNames specifies whether or not unquoted field names are allowed in JSON text passed to thepub.json:jsonStringToDocument and pub.json:jsonStreamToDocument services. If this parameter is set to true, the pub.json:jsonStringToDocument and pub.json:jsonStreamToDocument services allow unquoted field names in any supplied JSON text. If this parameter is set to false, the services throw a ServiceException when encountering unquoted field names. The default is false.
If decodeRealAsString is set to true and decodeRealAsDouble is either set to true or left blank, an error message is displayed.
SetdecodeRealAsString to true to prevent the conversion of real numbers to scientific notation.
Important:
Since this service loads the whole JSON data into memory and then converts it to an IData object, it is not meant to process large JSON files (for example, 50GB or more). Large JSON files can be processed in fixed-size logical chunks using the pub.json:getArrayIterator, pub.json:getNextBatch and the pub.json:closeArrayIterator public services together.