org.json.JSONException: Misshaped element
lhoskins Jan 25, 2019 2:49 PMHi All, I need some help with JSON error on Wildfly.
I am using RESTEASY with JAX-RS. The preview of the JSON data outputs as expected but when I run from Teiid Swagger or the url directly from the browser I get the following error:
</style></head><body><div class="header"><div class="error-div"></div><div class="error-text-div">Error processing request</div></div><div class="label">Context Path:</div><div class="value">/category</div><br/><div class="label">Servlet Path:</div><div class="value">/CategoryREST</div><br/><div class="label">Path Info:</div><div class="value">/json/category</div><br/><div class="label">Query String:</div><div class="value">null</div><br/><div class="label">Stack Trace:</div><div class="value"></div><br/><pre>org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: org.json.JSONException: Misshaped element. at character 298 of {"agg0":[{"category_description":"Current Year's Actuals","category_id":"ACTUAL"},{"category_description":"Adjustment for Budget input","category_id":"ADJUSTMENT"},{"category_description":"Current Year's Budget","category_id":"BUDGET"},{"category_description":"Forecast","category_id":"FORECAST"}]} at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:78) at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:222) at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:179)
The json string was validated through a third party application. I'm using the following select statement:
BEGIN
SELECT JSONOBJECT(JSONARRAY_AGG(JSONOBJECT(Category.category.category_description, Category.category.category_id))) AS Json FROM Category.category;
END
Results from the SQL Results pane
REST Properties
-
direct browser error.txt.zip 1.5 KB
-
swagger error.txt.zip 4.3 KB
-
Console log.txt.zip 2.0 KB