facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
402 stars 332 forks source link

ProductItem convert error #388

Open damonandall opened 2 years ago

damonandall commented 2 years ago

Which SDK version are you using?

com.facebook.business.sdk:facebook-java-business-sdk:13.0.0

What's the issue?

Caused by: java.lang.IllegalStateException: Not a JSON Object

class

ProductItem

error code

           obj = obj.get("images").getAsJsonObject();
            Iterator var10 = obj.entrySet().iterator();

            while(var10.hasNext()) {
                Entry<String, JsonElement> entry = (Entry)var10.next();
                productItems.add(loadJSON(((JsonElement)entry.getValue()).toString(), context, header));
            }

            return productItems;

images is the list of string

should instanceof JsonObject or JsonArray

if (obj instanceof JsonObject) { JsonObject jobject = obj.getAsJsonObject(); } else if (obj instanceof JsonArray) { JsonArray jarray = obj.getAsJsonArray(); }