1

There's a feature in the UI to enter description text.

When a user enters an empty [] in the UI, that gets converted as an empty JSONArray and it throws an exception since the code expects a String however gets a JSONArray.

Input coming from UI:

{"original":{"description":"[rtsASDl"},"modified":{"description":"[]"}}

Raw data gets cleaned in this line. Result looks like:

String rawData = EncodeSpecialCharactersFilter.unclean(data);

{"original":{"description":"[rtsASDl"},"modified":{"description":"[]"}}

Upon converting this to JSONObject, the empty array [] gets converted to JSONArray.

JSONObject containerData = JSONObject.fromObject(rawData);

 key = "description"
 value = {JSONArray@26344}  size = 0

Is it possible to make it a String instead?
Aqua267
  • 873
  • 3
  • 12
  • 35

0 Answers0