X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=restapi-call-node%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fccsdk%2Fsli%2Fplugins%2Frestapicall%2FJsonParser.java;fp=restapi-call-node%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fccsdk%2Fsli%2Fplugins%2Frestapicall%2FJsonParser.java;h=910baf52b5dbf8e485d03cb8ea5589fc7c19fc48;hb=43c9e83b3cc9b3dfaf55f08fc25813a77a4f2784;hp=189ddde313aab1e422673b269d3e7952fdfd8e2c;hpb=f396b85b5815ea0cdfeed96f999ed360e2a9ee9d;p=ccsdk%2Fsli%2Fplugins.git diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java index 189ddde3..910baf52 100644 --- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java +++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java @@ -8,7 +8,7 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -50,7 +50,15 @@ public final class JsonParser { checkNotNull(s, "Input should not be null."); try { - JSONObject json = new JSONObject(s); + JSONObject json = null; + //support top level list in json response + if (s.startsWith("[")) { + JSONArray jsonArr = new JSONArray(s); + json = jsonArr.getJSONObject(0); + } else { + json = new JSONObject(s); + } + Map wm = new HashMap<>(); Iterator ii = json.keys(); while (ii.hasNext()) {