Example usage for com.google.gson JsonParser parse

List of usage examples for com.google.gson JsonParser parse

Introduction

In this page you can find the example usage for com.google.gson JsonParser parse.

Prototype

@Deprecated
public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException 

Source Link

Usage

From source file:com.facebook.ads.sdk.AdCreativeObjectStorySpec.java

License:Open Source License

public static APINodeList<AdCreativeObjectStorySpec> parseResponse(String json, APIContext context,
        APIRequest request) throws MalformedResponseException {
    APINodeList<AdCreativeObjectStorySpec> adCreativeObjectStorySpecs = new APINodeList<AdCreativeObjectStorySpec>(
            request, json);/*w  w  w. jav  a 2 s .c  om*/
    JsonArray arr;
    JsonObject obj;
    JsonParser parser = new JsonParser();
    Exception exception = null;
    try {
        JsonElement result = parser.parse(json);
        if (result.isJsonArray()) {
            // First, check if it's a pure JSON Array
            arr = result.getAsJsonArray();
            for (int i = 0; i < arr.size(); i++) {
                adCreativeObjectStorySpecs.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
            }
            ;
            return adCreativeObjectStorySpecs;
        } else if (result.isJsonObject()) {
            obj = result.getAsJsonObject();
            if (obj.has("data")) {
                if (obj.has("paging")) {
                    JsonObject paging = obj.get("paging").getAsJsonObject().get("cursors").getAsJsonObject();
                    String before = paging.has("before") ? paging.get("before").getAsString() : null;
                    String after = paging.has("after") ? paging.get("after").getAsString() : null;
                    adCreativeObjectStorySpecs.setPaging(before, after);
                }
                if (obj.get("data").isJsonArray()) {
                    // Second, check if it's a JSON array with "data"
                    arr = obj.get("data").getAsJsonArray();
                    for (int i = 0; i < arr.size(); i++) {
                        adCreativeObjectStorySpecs
                                .add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
                    }
                    ;
                } else if (obj.get("data").isJsonObject()) {
                    // Third, check if it's a JSON object with "data"
                    obj = obj.get("data").getAsJsonObject();
                    boolean isRedownload = false;
                    for (String s : new String[] { "campaigns", "adsets", "ads" }) {
                        if (obj.has(s)) {
                            isRedownload = true;
                            obj = obj.getAsJsonObject(s);
                            for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                                adCreativeObjectStorySpecs.add(loadJSON(entry.getValue().toString(), context));
                            }
                            break;
                        }
                    }
                    if (!isRedownload) {
                        adCreativeObjectStorySpecs.add(loadJSON(obj.toString(), context));
                    }
                }
                return adCreativeObjectStorySpecs;
            } else if (obj.has("images")) {
                // Fourth, check if it's a map of image objects
                obj = obj.get("images").getAsJsonObject();
                for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                    adCreativeObjectStorySpecs.add(loadJSON(entry.getValue().toString(), context));
                }
                return adCreativeObjectStorySpecs;
            } else {
                // Fifth, check if it's an array of objects indexed by id
                boolean isIdIndexedArray = true;
                for (Map.Entry entry : obj.entrySet()) {
                    String key = (String) entry.getKey();
                    if (key.equals("__fb_trace_id__")) {
                        continue;
                    }
                    JsonElement value = (JsonElement) entry.getValue();
                    if (value != null && value.isJsonObject() && value.getAsJsonObject().has("id")
                            && value.getAsJsonObject().get("id") != null
                            && value.getAsJsonObject().get("id").getAsString().equals(key)) {
                        adCreativeObjectStorySpecs.add(loadJSON(value.toString(), context));
                    } else {
                        isIdIndexedArray = false;
                        break;
                    }
                }
                if (isIdIndexedArray) {
                    return adCreativeObjectStorySpecs;
                }

                // Sixth, check if it's pure JsonObject
                adCreativeObjectStorySpecs.clear();
                adCreativeObjectStorySpecs.add(loadJSON(json, context));
                return adCreativeObjectStorySpecs;
            }
        }
    } catch (Exception e) {
        exception = e;
    }
    throw new MalformedResponseException("Invalid response string: " + json, exception);
}

From source file:com.facebook.ads.sdk.AdCreativeOfferData.java

License:Open Source License

public static AdCreativeOfferData loadJSON(String json, APIContext context) {
    AdCreativeOfferData adCreativeOfferData = getGson().fromJson(json, AdCreativeOfferData.class);
    if (context.isDebug()) {
        JsonParser parser = new JsonParser();
        JsonElement o1 = parser.parse(json);
        JsonElement o2 = parser.parse(adCreativeOfferData.toString());
        if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
            o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
        }/*from ww w.  j av a  2s  .  c om*/
        if (!o1.equals(o2)) {
            context.log("[Warning] When parsing response, object is not consistent with JSON:");
            context.log("[JSON]" + o1);
            context.log("[Object]" + o2);
        }
        ;
    }
    adCreativeOfferData.context = context;
    adCreativeOfferData.rawValue = json;
    return adCreativeOfferData;
}

From source file:com.facebook.ads.sdk.AdCreativeOfferData.java

License:Open Source License

public static APINodeList<AdCreativeOfferData> parseResponse(String json, APIContext context,
        APIRequest request) throws MalformedResponseException {
    APINodeList<AdCreativeOfferData> adCreativeOfferDatas = new APINodeList<AdCreativeOfferData>(request, json);
    JsonArray arr;//from   ww  w . ja  v  a 2s .com
    JsonObject obj;
    JsonParser parser = new JsonParser();
    Exception exception = null;
    try {
        JsonElement result = parser.parse(json);
        if (result.isJsonArray()) {
            // First, check if it's a pure JSON Array
            arr = result.getAsJsonArray();
            for (int i = 0; i < arr.size(); i++) {
                adCreativeOfferDatas.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
            }
            ;
            return adCreativeOfferDatas;
        } else if (result.isJsonObject()) {
            obj = result.getAsJsonObject();
            if (obj.has("data")) {
                if (obj.has("paging")) {
                    JsonObject paging = obj.get("paging").getAsJsonObject().get("cursors").getAsJsonObject();
                    String before = paging.has("before") ? paging.get("before").getAsString() : null;
                    String after = paging.has("after") ? paging.get("after").getAsString() : null;
                    adCreativeOfferDatas.setPaging(before, after);
                }
                if (obj.get("data").isJsonArray()) {
                    // Second, check if it's a JSON array with "data"
                    arr = obj.get("data").getAsJsonArray();
                    for (int i = 0; i < arr.size(); i++) {
                        adCreativeOfferDatas.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
                    }
                    ;
                } else if (obj.get("data").isJsonObject()) {
                    // Third, check if it's a JSON object with "data"
                    obj = obj.get("data").getAsJsonObject();
                    boolean isRedownload = false;
                    for (String s : new String[] { "campaigns", "adsets", "ads" }) {
                        if (obj.has(s)) {
                            isRedownload = true;
                            obj = obj.getAsJsonObject(s);
                            for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                                adCreativeOfferDatas.add(loadJSON(entry.getValue().toString(), context));
                            }
                            break;
                        }
                    }
                    if (!isRedownload) {
                        adCreativeOfferDatas.add(loadJSON(obj.toString(), context));
                    }
                }
                return adCreativeOfferDatas;
            } else if (obj.has("images")) {
                // Fourth, check if it's a map of image objects
                obj = obj.get("images").getAsJsonObject();
                for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                    adCreativeOfferDatas.add(loadJSON(entry.getValue().toString(), context));
                }
                return adCreativeOfferDatas;
            } else {
                // Fifth, check if it's an array of objects indexed by id
                boolean isIdIndexedArray = true;
                for (Map.Entry entry : obj.entrySet()) {
                    String key = (String) entry.getKey();
                    if (key.equals("__fb_trace_id__")) {
                        continue;
                    }
                    JsonElement value = (JsonElement) entry.getValue();
                    if (value != null && value.isJsonObject() && value.getAsJsonObject().has("id")
                            && value.getAsJsonObject().get("id") != null
                            && value.getAsJsonObject().get("id").getAsString().equals(key)) {
                        adCreativeOfferDatas.add(loadJSON(value.toString(), context));
                    } else {
                        isIdIndexedArray = false;
                        break;
                    }
                }
                if (isIdIndexedArray) {
                    return adCreativeOfferDatas;
                }

                // Sixth, check if it's pure JsonObject
                adCreativeOfferDatas.clear();
                adCreativeOfferDatas.add(loadJSON(json, context));
                return adCreativeOfferDatas;
            }
        }
    } catch (Exception e) {
        exception = e;
    }
    throw new MalformedResponseException("Invalid response string: " + json, exception);
}

From source file:com.facebook.ads.sdk.AdCreativePhotoData.java

License:Open Source License

public static AdCreativePhotoData loadJSON(String json, APIContext context) {
    AdCreativePhotoData adCreativePhotoData = getGson().fromJson(json, AdCreativePhotoData.class);
    if (context.isDebug()) {
        JsonParser parser = new JsonParser();
        JsonElement o1 = parser.parse(json);
        JsonElement o2 = parser.parse(adCreativePhotoData.toString());
        if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
            o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
        }//  w ww .  j  av a  2s .c  o m
        if (!o1.equals(o2)) {
            context.log("[Warning] When parsing response, object is not consistent with JSON:");
            context.log("[JSON]" + o1);
            context.log("[Object]" + o2);
        }
        ;
    }
    adCreativePhotoData.context = context;
    adCreativePhotoData.rawValue = json;
    return adCreativePhotoData;
}

From source file:com.facebook.ads.sdk.AdCreativePhotoData.java

License:Open Source License

public static APINodeList<AdCreativePhotoData> parseResponse(String json, APIContext context,
        APIRequest request) throws MalformedResponseException {
    APINodeList<AdCreativePhotoData> adCreativePhotoDatas = new APINodeList<AdCreativePhotoData>(request, json);
    JsonArray arr;/*from   www  . j a v  a 2 s  .  co  m*/
    JsonObject obj;
    JsonParser parser = new JsonParser();
    Exception exception = null;
    try {
        JsonElement result = parser.parse(json);
        if (result.isJsonArray()) {
            // First, check if it's a pure JSON Array
            arr = result.getAsJsonArray();
            for (int i = 0; i < arr.size(); i++) {
                adCreativePhotoDatas.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
            }
            ;
            return adCreativePhotoDatas;
        } else if (result.isJsonObject()) {
            obj = result.getAsJsonObject();
            if (obj.has("data")) {
                if (obj.has("paging")) {
                    JsonObject paging = obj.get("paging").getAsJsonObject().get("cursors").getAsJsonObject();
                    String before = paging.has("before") ? paging.get("before").getAsString() : null;
                    String after = paging.has("after") ? paging.get("after").getAsString() : null;
                    adCreativePhotoDatas.setPaging(before, after);
                }
                if (obj.get("data").isJsonArray()) {
                    // Second, check if it's a JSON array with "data"
                    arr = obj.get("data").getAsJsonArray();
                    for (int i = 0; i < arr.size(); i++) {
                        adCreativePhotoDatas.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
                    }
                    ;
                } else if (obj.get("data").isJsonObject()) {
                    // Third, check if it's a JSON object with "data"
                    obj = obj.get("data").getAsJsonObject();
                    boolean isRedownload = false;
                    for (String s : new String[] { "campaigns", "adsets", "ads" }) {
                        if (obj.has(s)) {
                            isRedownload = true;
                            obj = obj.getAsJsonObject(s);
                            for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                                adCreativePhotoDatas.add(loadJSON(entry.getValue().toString(), context));
                            }
                            break;
                        }
                    }
                    if (!isRedownload) {
                        adCreativePhotoDatas.add(loadJSON(obj.toString(), context));
                    }
                }
                return adCreativePhotoDatas;
            } else if (obj.has("images")) {
                // Fourth, check if it's a map of image objects
                obj = obj.get("images").getAsJsonObject();
                for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                    adCreativePhotoDatas.add(loadJSON(entry.getValue().toString(), context));
                }
                return adCreativePhotoDatas;
            } else {
                // Fifth, check if it's an array of objects indexed by id
                boolean isIdIndexedArray = true;
                for (Map.Entry entry : obj.entrySet()) {
                    String key = (String) entry.getKey();
                    if (key.equals("__fb_trace_id__")) {
                        continue;
                    }
                    JsonElement value = (JsonElement) entry.getValue();
                    if (value != null && value.isJsonObject() && value.getAsJsonObject().has("id")
                            && value.getAsJsonObject().get("id") != null
                            && value.getAsJsonObject().get("id").getAsString().equals(key)) {
                        adCreativePhotoDatas.add(loadJSON(value.toString(), context));
                    } else {
                        isIdIndexedArray = false;
                        break;
                    }
                }
                if (isIdIndexedArray) {
                    return adCreativePhotoDatas;
                }

                // Sixth, check if it's pure JsonObject
                adCreativePhotoDatas.clear();
                adCreativePhotoDatas.add(loadJSON(json, context));
                return adCreativePhotoDatas;
            }
        }
    } catch (Exception e) {
        exception = e;
    }
    throw new MalformedResponseException("Invalid response string: " + json, exception);
}

From source file:com.facebook.ads.sdk.AdCreativePlaceData.java

License:Open Source License

public static AdCreativePlaceData loadJSON(String json, APIContext context) {
    AdCreativePlaceData adCreativePlaceData = getGson().fromJson(json, AdCreativePlaceData.class);
    if (context.isDebug()) {
        JsonParser parser = new JsonParser();
        JsonElement o1 = parser.parse(json);
        JsonElement o2 = parser.parse(adCreativePlaceData.toString());
        if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
            o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
        }/*from  w ww .java  2 s . c  o  m*/
        if (!o1.equals(o2)) {
            context.log("[Warning] When parsing response, object is not consistent with JSON:");
            context.log("[JSON]" + o1);
            context.log("[Object]" + o2);
        }
        ;
    }
    adCreativePlaceData.context = context;
    adCreativePlaceData.rawValue = json;
    return adCreativePlaceData;
}

From source file:com.facebook.ads.sdk.AdCreativePlaceData.java

License:Open Source License

public static APINodeList<AdCreativePlaceData> parseResponse(String json, APIContext context,
        APIRequest request) throws MalformedResponseException {
    APINodeList<AdCreativePlaceData> adCreativePlaceDatas = new APINodeList<AdCreativePlaceData>(request, json);
    JsonArray arr;/*from   w  w  w  .java2s .c  om*/
    JsonObject obj;
    JsonParser parser = new JsonParser();
    Exception exception = null;
    try {
        JsonElement result = parser.parse(json);
        if (result.isJsonArray()) {
            // First, check if it's a pure JSON Array
            arr = result.getAsJsonArray();
            for (int i = 0; i < arr.size(); i++) {
                adCreativePlaceDatas.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
            }
            ;
            return adCreativePlaceDatas;
        } else if (result.isJsonObject()) {
            obj = result.getAsJsonObject();
            if (obj.has("data")) {
                if (obj.has("paging")) {
                    JsonObject paging = obj.get("paging").getAsJsonObject().get("cursors").getAsJsonObject();
                    String before = paging.has("before") ? paging.get("before").getAsString() : null;
                    String after = paging.has("after") ? paging.get("after").getAsString() : null;
                    adCreativePlaceDatas.setPaging(before, after);
                }
                if (obj.get("data").isJsonArray()) {
                    // Second, check if it's a JSON array with "data"
                    arr = obj.get("data").getAsJsonArray();
                    for (int i = 0; i < arr.size(); i++) {
                        adCreativePlaceDatas.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
                    }
                    ;
                } else if (obj.get("data").isJsonObject()) {
                    // Third, check if it's a JSON object with "data"
                    obj = obj.get("data").getAsJsonObject();
                    boolean isRedownload = false;
                    for (String s : new String[] { "campaigns", "adsets", "ads" }) {
                        if (obj.has(s)) {
                            isRedownload = true;
                            obj = obj.getAsJsonObject(s);
                            for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                                adCreativePlaceDatas.add(loadJSON(entry.getValue().toString(), context));
                            }
                            break;
                        }
                    }
                    if (!isRedownload) {
                        adCreativePlaceDatas.add(loadJSON(obj.toString(), context));
                    }
                }
                return adCreativePlaceDatas;
            } else if (obj.has("images")) {
                // Fourth, check if it's a map of image objects
                obj = obj.get("images").getAsJsonObject();
                for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                    adCreativePlaceDatas.add(loadJSON(entry.getValue().toString(), context));
                }
                return adCreativePlaceDatas;
            } else {
                // Fifth, check if it's an array of objects indexed by id
                boolean isIdIndexedArray = true;
                for (Map.Entry entry : obj.entrySet()) {
                    String key = (String) entry.getKey();
                    if (key.equals("__fb_trace_id__")) {
                        continue;
                    }
                    JsonElement value = (JsonElement) entry.getValue();
                    if (value != null && value.isJsonObject() && value.getAsJsonObject().has("id")
                            && value.getAsJsonObject().get("id") != null
                            && value.getAsJsonObject().get("id").getAsString().equals(key)) {
                        adCreativePlaceDatas.add(loadJSON(value.toString(), context));
                    } else {
                        isIdIndexedArray = false;
                        break;
                    }
                }
                if (isIdIndexedArray) {
                    return adCreativePlaceDatas;
                }

                // Sixth, check if it's pure JsonObject
                adCreativePlaceDatas.clear();
                adCreativePlaceDatas.add(loadJSON(json, context));
                return adCreativePlaceDatas;
            }
        }
    } catch (Exception e) {
        exception = e;
    }
    throw new MalformedResponseException("Invalid response string: " + json, exception);
}

From source file:com.facebook.ads.sdk.AdCreativeTextData.java

License:Open Source License

public static AdCreativeTextData loadJSON(String json, APIContext context) {
    AdCreativeTextData adCreativeTextData = getGson().fromJson(json, AdCreativeTextData.class);
    if (context.isDebug()) {
        JsonParser parser = new JsonParser();
        JsonElement o1 = parser.parse(json);
        JsonElement o2 = parser.parse(adCreativeTextData.toString());
        if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
            o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
        }//  w  w  w . j  a  v a 2s.c  o  m
        if (!o1.equals(o2)) {
            context.log("[Warning] When parsing response, object is not consistent with JSON:");
            context.log("[JSON]" + o1);
            context.log("[Object]" + o2);
        }
        ;
    }
    adCreativeTextData.context = context;
    adCreativeTextData.rawValue = json;
    return adCreativeTextData;
}

From source file:com.facebook.ads.sdk.AdCreativeTextData.java

License:Open Source License

public static APINodeList<AdCreativeTextData> parseResponse(String json, APIContext context, APIRequest request)
        throws MalformedResponseException {
    APINodeList<AdCreativeTextData> adCreativeTextDatas = new APINodeList<AdCreativeTextData>(request, json);
    JsonArray arr;//from  w  w  w .j av  a2 s  .com
    JsonObject obj;
    JsonParser parser = new JsonParser();
    Exception exception = null;
    try {
        JsonElement result = parser.parse(json);
        if (result.isJsonArray()) {
            // First, check if it's a pure JSON Array
            arr = result.getAsJsonArray();
            for (int i = 0; i < arr.size(); i++) {
                adCreativeTextDatas.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
            }
            ;
            return adCreativeTextDatas;
        } else if (result.isJsonObject()) {
            obj = result.getAsJsonObject();
            if (obj.has("data")) {
                if (obj.has("paging")) {
                    JsonObject paging = obj.get("paging").getAsJsonObject().get("cursors").getAsJsonObject();
                    String before = paging.has("before") ? paging.get("before").getAsString() : null;
                    String after = paging.has("after") ? paging.get("after").getAsString() : null;
                    adCreativeTextDatas.setPaging(before, after);
                }
                if (obj.get("data").isJsonArray()) {
                    // Second, check if it's a JSON array with "data"
                    arr = obj.get("data").getAsJsonArray();
                    for (int i = 0; i < arr.size(); i++) {
                        adCreativeTextDatas.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context));
                    }
                    ;
                } else if (obj.get("data").isJsonObject()) {
                    // Third, check if it's a JSON object with "data"
                    obj = obj.get("data").getAsJsonObject();
                    boolean isRedownload = false;
                    for (String s : new String[] { "campaigns", "adsets", "ads" }) {
                        if (obj.has(s)) {
                            isRedownload = true;
                            obj = obj.getAsJsonObject(s);
                            for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                                adCreativeTextDatas.add(loadJSON(entry.getValue().toString(), context));
                            }
                            break;
                        }
                    }
                    if (!isRedownload) {
                        adCreativeTextDatas.add(loadJSON(obj.toString(), context));
                    }
                }
                return adCreativeTextDatas;
            } else if (obj.has("images")) {
                // Fourth, check if it's a map of image objects
                obj = obj.get("images").getAsJsonObject();
                for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
                    adCreativeTextDatas.add(loadJSON(entry.getValue().toString(), context));
                }
                return adCreativeTextDatas;
            } else {
                // Fifth, check if it's an array of objects indexed by id
                boolean isIdIndexedArray = true;
                for (Map.Entry entry : obj.entrySet()) {
                    String key = (String) entry.getKey();
                    if (key.equals("__fb_trace_id__")) {
                        continue;
                    }
                    JsonElement value = (JsonElement) entry.getValue();
                    if (value != null && value.isJsonObject() && value.getAsJsonObject().has("id")
                            && value.getAsJsonObject().get("id") != null
                            && value.getAsJsonObject().get("id").getAsString().equals(key)) {
                        adCreativeTextDatas.add(loadJSON(value.toString(), context));
                    } else {
                        isIdIndexedArray = false;
                        break;
                    }
                }
                if (isIdIndexedArray) {
                    return adCreativeTextDatas;
                }

                // Sixth, check if it's pure JsonObject
                adCreativeTextDatas.clear();
                adCreativeTextDatas.add(loadJSON(json, context));
                return adCreativeTextDatas;
            }
        }
    } catch (Exception e) {
        exception = e;
    }
    throw new MalformedResponseException("Invalid response string: " + json, exception);
}

From source file:com.facebook.ads.sdk.AdCreativeVideoData.java

License:Open Source License

public static AdCreativeVideoData loadJSON(String json, APIContext context) {
    AdCreativeVideoData adCreativeVideoData = getGson().fromJson(json, AdCreativeVideoData.class);
    if (context.isDebug()) {
        JsonParser parser = new JsonParser();
        JsonElement o1 = parser.parse(json);
        JsonElement o2 = parser.parse(adCreativeVideoData.toString());
        if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
            o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
        }//from w ww.j  a v  a2  s  .  c o  m
        if (!o1.equals(o2)) {
            context.log("[Warning] When parsing response, object is not consistent with JSON:");
            context.log("[JSON]" + o1);
            context.log("[Object]" + o2);
        }
        ;
    }
    adCreativeVideoData.context = context;
    adCreativeVideoData.rawValue = json;
    return adCreativeVideoData;
}