com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY
at
line 39 column 20 path $.conversions.word.heading.styles
Based on preliminary investigation, the "line 39 column 20" in the sdk referred to in the stack trace is referring to the JSON response stream. And what the Expected BEGIN_OBJECT but was BEGIN_ARRAY error usually signifies is that the code is trying to pass an array return type into an object as opposed to creating an array to store the data.
The strange thing is that the customer's two lines of code are working fine for the default configuration of the read-only environment (in this case the configuration, or some part of it, is a single JSON object), while they are wrong for the configuration of the environment that was created by the Discovery Service online tool (in this case the configuration, or some part of it, looks like a JSON array).
So I can't tell if this is an issue with the sdk not correctly handling what Discovery considers valid output, or if the Discovery service needs to adjust how it outputs data in order to be compatible with the sdk?
We have a customer who is trying to run Discovery code using the Watson java sdk "java-sdk-3.5.3-jar-with-dependencies.jar", the following:
with:
is returning:
Based on preliminary investigation, the "line 39 column 20" in the sdk referred to in the stack trace is referring to the JSON response stream. And what the Expected BEGIN_OBJECT but was BEGIN_ARRAY error usually signifies is that the code is trying to pass an array return type into an object as opposed to creating an array to store the data.
The strange thing is that the customer's two lines of code are working fine for the default configuration of the read-only environment (in this case the configuration, or some part of it, is a single JSON object), while they are wrong for the configuration of the environment that was created by the Discovery Service online tool (in this case the configuration, or some part of it, looks like a JSON array).
So I can't tell if this is an issue with the sdk not correctly handling what Discovery considers valid output, or if the Discovery service needs to adjust how it outputs data in order to be compatible with the sdk?