Which is the best option to create a JSONObject
and JSONArray
in Liferay portlet?
You can't do Java
simple way:
JSONObject json = new JSONObject();
JSONArray arrayJson = new JSONArray();
Error:
Cannot instantiate the type JSONObject
Cannot instantiate the type JSONArray
Tried with JSONFactoryUtil
and it works but its deprecated.
com.liferay.util.json.JSONFactoryUtil
JSONObject json = JSONFactoryUtil.createJSONObject();
JSONArray arrayJson = JSONFactoryUtil.createJSONArray();