Parse JSON activity element length limit

Parse JSON activity element length limit

book

Article ID: KB0080400

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON 2.0.0

Description

When passing JSON data to Parse JSON activity, if the element length limit in the type exceeds 512, The parse JSON activity will fail to parse the JSON to XML with following error:
An error occurred while converting json to xml:  Invalid JSON .
    at com.tibco.plugin.json.activities.JSONParserActivity.eval(JSONParserActivity.java:244)
    at com.tibco.pe.plugin.Activity.eval(Unknown Source)
    at com.tibco.pe.core.TaskImpl.eval(Unknown Source)
    at com.tibco.pe.core.Job.a(Unknown Source)
    at com.tibco.pe.core.Job.k(Unknown Source)
    at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source)
    at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source)
caused by: cn.techlab.datar.exception.ParserException: Invalid JSON
    at cn.techlab.datar.json.JSONParser.error(JSONParser.java:301)
    at cn.techlab.datar.json.JSONParser.invalidJSON(JSONParser.java:291)
    at cn.techlab.datar.json.JSONParser.parse(JSONParser.java:174)
    at cn.techlab.datar.json.JSONParser.parse(JSONParser.java:141)
    at cn.techlab.datar.json.JSONParser.parse(JSONParser.java:108)
    at cn.techlab.datar.json.JSONParser.parse(JSONParser.java:108)
    at cn.techlab.datar.json.JSONParser.parse(JSONParser.java:69)
    at com.tibco.plugin.json.runtime.parser.JSONParser.parse(JSONParser.java:142)
    at com.tibco.plugin.json.activities.JSONParserActivity.eval(JSONParserActivity.java:187)
    at com.tibco.pe.plugin.Activity.eval(Unknown Source)
    at com.tibco.pe.core.TaskImpl.eval(Unknown Source)
    at com.tibco.pe.core.Job.a(Unknown Source)
    at com.tibco.pe.core.Job.k(Unknown Source)
    at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source)
    at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source)

Sample Input:
QueryString : {  "RemovedInstructionsRequest": {    "InstructionId":[      98721010,      98720735,      98717499,      98717562,      98720816,      98717085,      98717142,      98720762,      98717248,      98717242,      98717131,      98717572,      98717903,      98717087,      98721013,      98720726,      98720950,      98720790,      98720814,      98717710,      98717661,      98717511,      98717269,      98717563,      98720783,      98717897,      98717316,      98720824,      98717547,      98717694,      98717358,      98720995,      98717428,      98717780,      98720911],    "userName": "xxxx@example.com", "token": "1429" } }
Transaction_Id:12345

In the above example, InstructionId element has an array of values which exceeds 512 length limit. Hence, you will get the An error occurred while converting json to xml:  Invalid JSON error.

Issue/Introduction

For Parse JSON activity, there has element length limit in the type.

Environment

All Environments

Resolution

In REST Plugin 2.0.0, ParseJSON Activity has element length limit in the type. Starting from the second element of the array, to the end of the array, the total length can not exceed 512.

To resolve this issue, We have a workaround: 

Please add below property in Designer.tra: 
"java.property.com.tibco.plugin.restjson.json.111CompatibleMode=true" and Restart the Designer. 
This will allow element with exceeding the limit of length allow to parse without any error. 

OR

Alternatively, this issue has been resolved in REST and JSON plugin 2.0.0 HF 8. After installing the HF-8, there is no need to add above property. 
This HF removes the 512 element limit of length for parsing. 


Additional Information

Invalid-JSON, Parse JSON, Length, Limit, com.tibco.plugin.json.activities.JSONParserActivity.eval