- } else {
- Entry<String, JsonElement> childEntry = Lists.newArrayList(entrySetsOfRootJsonObject).get(0);
- String firstElementName = childEntry.getKey();
- JsonElement firstElementType = childEntry.getValue();
- if (firstElementType.isJsonObject()) { // container in yang
- return createStructureWithRoot(firstElementName, firstElementType.getAsJsonObject());
- }
- if (firstElementType.isJsonArray()) { // list in yang
- if (firstElementType.getAsJsonArray().size() == 1) {
- JsonElement firstElementInArray = firstElementType.getAsJsonArray().get(0);
- if (firstElementInArray.isJsonObject()) {
- return createStructureWithRoot(firstElementName, firstElementInArray.getAsJsonObject());
- }
- throw new UnsupportedFormatException(
- "Array as the first element in Json Object can have only Object element");
+ }
+
+ Entry<String, JsonElement> childEntry = entrySetsOfRootJsonObject.iterator().next();
+ String firstElementName = childEntry.getKey();
+ JsonElement firstElementType = childEntry.getValue();
+ if (firstElementType.isJsonObject()) {
+ // container in yang
+ return createStructureWithRoot(firstElementName, firstElementType.getAsJsonObject());
+ }
+ if (firstElementType.isJsonArray()) {
+ // list in yang
+ if (firstElementType.getAsJsonArray().size() == 1) {
+ JsonElement firstElementInArray = firstElementType.getAsJsonArray().get(0);
+ if (firstElementInArray.isJsonObject()) {
+ return createStructureWithRoot(firstElementName, firstElementInArray.getAsJsonObject());