how to filter array embedded object array?
I use filter and some, but the result is not my though.
var data = [
{
"app": "mail",
"scenarios": [
{
"name": "",
"description": "plugin 1",
"contacts": [
{
"resourceId": "001",
"isPrimary": false
}
]
},
{
"name": "app2",
"description": "plugin 2",
"contacts": [
{
"resourceId": "002",
"isPrimary": false
}
]
}
]
},
{
"app": "mail2",
"scenarios": [
{
"name": "app1",
"description": "plugin 1",
"contacts": [
{
"resourceId": "001",
"isPrimary": false
}
]
},
{
"name": "app2",
"description": "plugin 2",
"contacts": [
{
"resourceId": "002",
"isPrimary": false
}
]
}
]
}
];
result = data.filter(app => app.scenarios.some(scenario => scenario.contacts.some(concact => concact.resourceId == '001')));
I want to filter the data to
[
{
"app": "mail",
"scenarios": [
{
"name": "",
"description": "plugin 1",
"contacts": [
{
"resourceId": "001",
"isPrimary": false
}
]
}
]
},
{
"app": "mail2",
"scenarios": [
{
"name": "app1",
"description": "plugin 1",
"contacts": [
{
"resourceId": "001",
"isPrimary": false
}
]
}
]
}
]
var data = [{"app":"mail","scenarios":[{"name":"","description":"plugin 1","contacts":[{"resourceId":"001","isPrimary":false}]},{"name":"app2","description":"plugin 2","contacts":[{"resourceId":"002","isPrimary":false}]}]},{"app":"mail2","scenarios":[{"name":"app1","description":"plugin 1","contacts":[{"resourceId":"001","isPrimary":false}]},{"name":"app2","description":"plugin 2","contacts":[{"resourceId":"002","isPrimary":false}]}]}];
result = data.filter(app => app.scenarios.some(scenario => scenario.contacts.some(concact => concact.resourceId == '001')));
console.log(result);
I think you need to filter the scenarios array and contacts array both. If you want to get a scenario which has at least one contact with resourceId === "001" you could do the following.
let data = [
{
"app": "mail",
"scenarios": [
{
"name": "",
"description": "plugin 1",
"contacts": [
{
"resourceId": "001",
"isPrimary": false
}
]
},
{
"name": "app2",
"description": "plugin 2",
"contacts": [
{
"resourceId": "002",
"isPrimary": false
}
]
}
]
},
{
"app": "mail2",
"scenarios": [
{
"name": "app1",
"description": "plugin 1",
"contacts": [
{
"resourceId": "001",
"isPrimary": false
}
]
},
{
"name": "app2",
"description": "plugin 2",
"contacts": [
{
"resourceId": "002",
"isPrimary": false
}
]
}
]
}
];
for(let item of data) {
item.scenarios = item.scenarios.filter(value => {
let validContacts = value.contacts.filter(contact => {
return contact.resourceId === "001";
})
return validContacts.length > 0;
})
}
console.log(data);
var data = [
{
"app": "mail",
"scenarios": [
{
"name": "",
"description": "plugin 1",
"contacts": [
{
"resourceId": "001",
"isPrimary": false
}
]
},
{
"name": "app2",
"description": "plugin 2",
"contacts": [
{
"resourceId": "002",
"isPrimary": false
}
]
}
]
},
{
"app": "mail2",
"scenarios": [
{
"name": "app1",
"description": "plugin 1",
"contacts": [
{
"resourceId": "001",
"isPrimary": false
}
]
},
{
"name": "app2",
"description": "plugin 2",
"contacts": [
{
"resourceId": "002",
"isPrimary": false
}
]
}
]
}
];
data.forEach(dat => {
dat.scenarios = dat.scenarios.find(da => da.contacts.find(x=>x.resourceId === "001"));
});
console.log(data)
You can go thru the code see if it fits what you're looking. An assumption made which contacts array will only have one element. Let me know if it's otherwise
Related
I want to iterate the tree and need to get the id of all the nodes which has the children in string array. while looping it is just returning me the record but doesn't extract the name of the node.
e.g const result = ['root', 'USER', 'ROLE', 'DASHBOARD', 'BRAND', 'COMPANY'];
{
"id": "root",
"name": "Roles and Permissions",
"children": [
{
"id": "USER",
"name": "USER",
"children": [
{
"id": "1",
"name": "VIEW"
},
{
"id": "2",
"name": "CREATE"
},
{
"id": "3",
"name": "EDIT"
}
]
},
{
"id": "ROLE",
"name": "ROLE",
"children": [
{
"id": "8",
"name": "VIEW"
},
{
"id": "9",
"name": "CREATE"
},
{
"id": "10",
"name": "EDIT"
},
{
"id": "11",
"name": "DELETE"
}
]
},
{
"id": "DASHBOARD",
"name": "DASHBOARD",
"children": [
{
"id": "BRAND",
"name": "BRAND",
"children": [
{
"id": "52",
"name": "VIEW"
},
{
"id": "53",
"name": "CREATE"
},
{
"id": "54",
"name": "EDIT"
},
{
"id": "55",
"name": "DELETE"
}
]
},
{
"id": "COMPANY",
"name": "COMPANY",
"children": [
{
"id": "56",
"name": "VIEW"
},
{
"id": "57",
"name": "CREATE"
},
{
"id": "58",
"name": "EDIT"
},
{
"id": "59",
"name": "DELETE"
}
]
}
]
}
]
}
I tried various looping method to get the list, e.g. but not returning the exact name of the node.
function getParent(nodes) {
if(Array.isArray(nodes.children)) {
return nodes.children.map((node) => getParent(node));
}
return nodes.name;
}
You can store the resp in an array and return that array.
const q = {
"id": "root",
"name": "Roles and Permissions",
"children": [
{
"id": "USER",
"name": "USER",
"children": [
{
"id": "1",
"name": "VIEW"
},
{
"id": "2",
"name": "CREATE"
},
{
"id": "3",
"name": "EDIT"
}
]
},
{
"id": "ROLE",
"name": "ROLE",
"children": [
{
"id": "8",
"name": "VIEW"
},
{
"id": "9",
"name": "CREATE"
},
{
"id": "10",
"name": "EDIT"
},
{
"id": "11",
"name": "DELETE"
}
]
},
{
"id": "DASHBOARD",
"name": "DASHBOARD",
"children": [
{
"id": "BRAND",
"name": "BRAND",
"children": [
{
"id": "52",
"name": "VIEW"
},
{
"id": "53",
"name": "CREATE"
},
{
"id": "54",
"name": "EDIT"
},
{
"id": "55",
"name": "DELETE"
}
]
},
{
"id": "COMPANY",
"name": "COMPANY",
"children": [
{
"id": "56",
"name": "VIEW"
},
{
"id": "57",
"name": "CREATE"
},
{
"id": "58",
"name": "EDIT"
},
{
"id": "59",
"name": "DELETE"
}
]
}
]
}
]
}
let result = []
function r(nodes){
if(Array.isArray(nodes.children)){
result.push(nodes.name);
nodes.children.map((c) => r(c))
return result;
}
return result;
}
console.log(r(q))
You can simply use a recursive function. Here ids is an array. You can initialize it before calling the function. Call this function in your getting IDs method.
const getIdFromNodesWithChild = (node) => {
if (node.children != undefined){
ids.push(node.id)
const children_list = node.children
children_list.forEach( new_child => getIdFromNodesWithChild(new_child))
}}
caller function
const returnIds = (tree) => {
ids = []
getIdFromNodesWithChild(tree)
return (ids)
}
result : ['root', 'USER', 'ROLE', 'DASHBOARD', 'BRAND', 'COMPANY']
I have this nested json object but I would like to construct a new one by taking elements of the original. I would like to make the second array below using the first, where the id key value becomes the key for a list of the emailAddress values in each permissionsOriginal:
[
{
"id": "1yKKftO0iOyvsacrW1mEr-tw43ttw3-8IorkDwiaYLgqI",
"name": "Doc Control",
"permissions": [
{
"emailAddress": "pkenny#cheese.co",
"role": "writer",
"displayName": "Bob Kenny"
},
{
"emailAddress": "nDrape#cheese.co",
"role": "writer",
"displayName": "Nute Drape"
}
]
},
{
"id": "149Lmt-g3w4w3efgh6thyherawer443awt3wrwa3rewrwa",
"name": "Untitled document",
"permissions": [
{
"emailAddress": "pkenny#cheese.co",
"role": "owner",
"displayName": "Bob Kenny"
}
]
},
{
"id": "egrs54h6w4hgwe5wegrgwegrhterwwrttre-Uffk8QRg4",
"name": "Documentation Control test",
"permissions": [
{
"emailAddress": "wDragon#cheese.co",
"role": "writer",
"displayName": "Grape Dragon"
},
{
"emailAddress": "pkenny#cheese.co",
"role": "owner",
"displayName": "Bob Kenny"
}
]
}
]
Second Snippet:
[
{
"1yKKftO0iOyvsacrW1mEr-tw43ttw3-8IorkDwiaYLgqI": [
"pkenny#cheese.co",
"nDrape#cheese.co"
]
},
{
"149Lmt-g3w4w3efgh6thyherawer443awt3wrwa3rewrwa": [
"pkenny#cheese.co"
]
},
{
"egrs54h6w4hgwe5wegrgwegrhterwwrttre-Uffk8QRg4": [
"wDragon#cheese.co",
"pkenny#cheese.co"
]
}
]
Loop through each element, then loop through permissions and extract the email.
let resp = [{
"id": "1yKKftO0iOyvsacrW1mEr-tw43ttw3-8IorkDwiaYLgqI",
"name": "Doc Control",
"permissions": [{
"emailAddress": "pkenny#cheese.co",
"role": "writer",
"displayName": "Bob Kenny"
},
{
"emailAddress": "nDrape#cheese.co",
"role": "writer",
"displayName": "Nute Drape"
}
]
},
{
"id": "149Lmt-g3w4w3efgh6thyherawer443awt3wrwa3rewrwa",
"name": "Untitled document",
"permissions": [{
"emailAddress": "pkenny#cheese.co",
"role": "owner",
"displayName": "Bob Kenny"
}]
},
{
"id": "egrs54h6w4hgwe5wegrgwegrhterwwrttre-Uffk8QRg4",
"name": "Documentation Control test",
"permissions": [{
"emailAddress": "wDragon#cheese.co",
"role": "writer",
"displayName": "Grape Dragon"
},
{
"emailAddress": "pkenny#cheese.co",
"role": "owner",
"displayName": "Bob Kenny"
}
]
}
]
let res = [];
resp.forEach((data) => {
let emailArray = [];
let resObj = {};
data.permissions.forEach((permData) => {
emailArray.push(permData['emailAddress']);
})
resObj[data.id] = emailArray;
res.push(resObj);
})
console.log(res);
My javascript array is as below. I want to remove all the null values inside all the children arrays. I managed to remove as below. but i'm looking for more elegant solution other than this
let data = [
{
"id": "359816ba-4bc6-4b7f-b57c-d80331eee0a6",
"name": "organization 1",
"type": "org",
"title": "organization 1",
"children": [
null,
{
"id": "6571cada-490c-41db-97e8-197a9c0faabb",
"name": "location 3",
"org_id": "359816ba-4bc6-4b7f-b57c-d80331eee0a6",
"type": "location",
"title": "location 3",
"children": [
null,
{
"id": "8620fce9-f7d0-442a-86e8-f58e9029a164",
"name": "zone 3",
"zone_settings_id": null,
"location_id": "6571cada-490c-41db-97e8-197a9c0faabb",
"type": "zone",
"title": "zone 3",
"children": [
null,
null,
null
]
},
null,
null
]
},
{
"id": "93b8ad9e-59ee-4de5-ac32-d3d5d19b083c",
"name": "location 4",
"org_id": "359816ba-4bc6-4b7f-b57c-d80331eee0a6",
"type": "location",
"title": "location 4",
"children": [
null,
null,
{
"id": "db14daf4-4488-47fa-8d18-2d213b3a54a5",
"name": "zone 4",
"zone_settings_id": null,
"location_id": "93b8ad9e-59ee-4de5-ac32-d3d5d19b083c",
"type": "zone",
"title": "zone 4",
"children": [
null,
null,
{
"id": "6ae5b04a-1101-4d73-80e4-05d4db454406",
"gwId": "E4956E45107R",
"zone_id": "db14daf4-4488-47fa-8d18-2d213b3a54a5",
"org_id": "359816ba-4bc6-4b7f-b57c-d80331eee0a6",
"title": "E4:95:6E:45:10:7R"
}
]
},
{
"id": "c01398c6-7650-426b-936d-6b88b1b507f2",
"name": "zone 5",
"zone_settings_id": null,
"location_id": "93b8ad9e-59ee-4de5-ac32-d3d5d19b083c",
"type": "zone",
"title": "zone 5",
"children": [
null,
null,
null
]
}
]
},
null
]
},
{
"id": "46665d49-020d-411f-9f11-c9ddad9a741c",
"name": "organization 2",
"type": "org",
"title": "organization 2",
"children": [
null,
null,
null,
null
]
},
{
"id": "95e7d05b-fe67-422d-8617-9f10633ea6f6",
"name": "org 3",
"type": "org",
"title": "org 3",
"children": [
null,
null,
null,
{
"id": "0a8509d8-1fd8-486c-8457-3ff393c09abc",
"name": "location 1 of org 3",
"org_id": "95e7d05b-fe67-422d-8617-9f10633ea6f6",
"type": "location",
"title": "location 1 of org 3",
"children": [
null,
null,
null,
null
]
}
]
}
]
let orgs = data.filter(org => org != null);
orgs.forEach(org => {
org.children = org.children.filter(location => location != null);
})
orgs.forEach(org => {
org.children.forEach(loc => {
loc.children = loc.children.filter(zone => zone != null);
})
})
orgs.forEach(org => {
org.children.forEach(loc => {
loc.children.forEach(zone => {
zone.children = zone.children.filter(router => router != null);
})
})
})
console.log(orgs);
const noNull = array => array
.filter(it => it !== null)
.map(it => it.children ? { ...it, children: noNull(it.children) } : it);
const result = noNull(data);
You could recursively filter the arrays in an immutable way.
Or the mutating version would be:
const noNull = array => {
const result = array.filter(it => it !== null);
for(const value of result)
if(value.children) value.children = noNull(value.children);
return result;
};
I want to implement a navigation bar using json data which is fetched by angular service. I ave my service and controller working great, but I am unable to render the nested json data into my view.
Below is my json data:
{
"menu": [
{
"name": "Electronics",
"link": "1",
"sub": [
{
"name": "Mobiles",
"link": "1.1",
"sub": [
{
"name": "Samsung",
"link": "1.1.1",
"sub": null
},
{
"name": "Apple",
"link": "1.1.2",
"sub": null
},
{
"name": "Motorola",
"link": "1.1.3",
"sub": null
},
{
"name": "Lenovo",
"link": "1.1.4",
"sub": null
},
{
"name": "Mi",
"link": "1.1.5",
"sub": null
},
{
"name": "Micromax",
"link": "1.1.6",
"sub": null
},
{
"name": "Oppo",
"link": "1.1.7",
"sub": null
},
{
"name": "Vivo",
"link": "1.1.8",
"sub": null
},
{
"name": "HTC",
"link": "1.1.9",
"sub": null
}
]
},
{
"name": "Mobile Accessories",
"link": "1.2",
"sub": [ ]
},
{
"name": "Laptop",
"link": "1.3",
"sub": [ ]
},
{
"name": "Laptop Accessories",
"link": "1.4",
"sub": [ ]
},
{
"name": "Appliances",
"link": "1.5",
"sub": [ ]
}
]
},
{
"name": "Men",
"link": "2",
"sub": [ ]
},
{
"name": "Women",
"link": "3",
"sub": [ ]
},
{
"name": "Baby & Kids",
"link": "4",
"sub": [ ]
},
{
"name": "Home & Furniture",
"link": "5",
"sub": [ ]
},
{
"name": "Books & More",
"link": "6",
"sub": [ ]
}
]
}
I am getting all the data in the console successfully, I just want help in rendering the data in the view using ng-repeat.
For reference, below is the controller and Factory
Factory:
( function ()
{
angular.module( "myApp" )
.factory( "navService", function ( $http )
{
function getNavItems()
{
return $http.get( '../data/navData.json' );
};
return {
getNavItems: getNavItems
};
} );
}()
Controller:
( function ()
{
angular.module( "myApp" )
.controller( "NavController", function ( $scope, $http, navService )
{
navService.getNavItems().then( function ( menu )
{
$scope.menu = menu.data;
console.log( menu.data );
} );
} );
} ());
Thanks.
It should be,
navService.getNavItems().then( function ( response)
{
$scope.menu = response.data.menu;
});
I have produce the same issues in my local and i am getting the error. but i tried to solve it and i have done.
you are using the controller name with camel case. so it's necessary to define use strict; at top of the controller and services JavaScript file.
Here is solution code.
Json Data file : navData.json
{
"menu": [
{
"name": "Electronics",
"link": "1",
"sub": [
{
"name": "Mobiles",
"link": "1.1",
"sub": [
{
"name": "Samsung",
"link": "1.1.1",
"sub": null
},
{
"name": "Apple",
"link": "1.1.2",
"sub": null
},
{
"name": "Motorola",
"link": "1.1.3",
"sub": null
},
{
"name": "Lenovo",
"link": "1.1.4",
"sub": null
},
{
"name": "Mi",
"link": "1.1.5",
"sub": null
},
{
"name": "Micromax",
"link": "1.1.6",
"sub": null
},
{
"name": "Oppo",
"link": "1.1.7",
"sub": null
},
{
"name": "Vivo",
"link": "1.1.8",
"sub": null
},
{
"name": "HTC",
"link": "1.1.9",
"sub": null
}
]
},
{
"name": "Mobile Accessories",
"link": "1.2",
"sub": [ ]
},
{
"name": "Laptop",
"link": "1.3",
"sub": [ ]
},
{
"name": "Laptop Accessories",
"link": "1.4",
"sub": [ ]
},
{
"name": "Appliances",
"link": "1.5",
"sub": [ ]
}
]
},
{
"name": "Men",
"link": "2",
"sub": [ ]
},
{
"name": "Women",
"link": "3",
"sub": [ ]
},
{
"name": "Baby & Kids",
"link": "4",
"sub": [ ]
},
{
"name": "Home & Furniture",
"link": "5",
"sub": [ ]
},
{
"name": "Books & More",
"link": "6",
"sub": [ ]
}
]
}
index.html
<html>
<head>
<title>Angular js</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.js"></script>
<script src="app.js"></script>
<script src="services.js"></script>
</head>
<body ng-app="myApp">
<p>Stackover flow Answer</p>
<p>Example use $scope out side from controller.</p>
<div ng-controller="NavController">
<div class="main_container">
<div ng-view></div>
</div>
</div>
</body>
</html>
app.js
"use strict";
var app = angular.module("myApp", []);
app.controller("NavController", function($scope, $http, navService){
navService.getNavItems().then( function ( menu ){
$scope.menu = menu.data;
console.log( menu.data );
});
});
services.js
"use strict";
app.factory( "navService", function ( $http ){
function getNavItems(){
return $http.get( 'data/navData.json' );
};
return {
getNavItems: getNavItems
};
});
I'm trying to display a Kendo treeview thanks to a HierarchicalDataSource.
It's a simple region, country, city hierarchy but the difficulty comes with the fact that we have 3 possible levels of regions and countries can appear at the second or at the third level.
Basically,
- First level of regions contains only other regions
- Second level of regions contains other regions or countries
- Third level of regions contains only countries
Here are my schemas:
var portsSchema = {
schema: {
data: "PortList",
model: {
id: "Code"
}
}
};
var countrySchema = {
schema: {
data: "CountryList",
model: {
id: "Code",
children: portsSchema
}
}
};
var regionCountrySchema = {
schema: {
data: "RegionList",
model: {
id: "id",
children: countrySchema
}
}
};
var regionSchema = {
schema: {
data: "RegionList",
model: {
id: "id",
children: regionCountrySchema
}
}
};
Depending on the fact that the region has countries or not, I would like to specify a specific type of children (regionSchema or regionCountrySchema).
var tvDataSource = new kendo.data.HierarchicalDataSource({
data: regions,
schema: {
model: function (data) {
**how to return the right children schema ?**
}
}
});
Returning { children: regionSchema } or {children: regionCountrySchema } triggers a js kendo error.
Any idea to achieve this ? Thank you.
JSON data sample below.
[
{
"Id": 1,
"Name": "MIDDLE EAST AND RED SEA",
"RegionList": [
{
"Id": 12,
"Name": "MIDDLE EAST",
"RegionList": [
{
"Id": 45,
"Name": "M. EAST",
"RegionList": [
],
"CountryList": [
{
"Id": 12007,
"Code": "AE",
"Name": "UAE",
"PortList": [
{
"Id": 6005,
"Code": "AEJEA",
"Name": "JEBEL ALI"
},
{
"Id": 16014,
"Code": "AEAJM",
"Name": "AJMAN"
},
{
"Id": 16015,
"Code": "AEAUH",
"Name": "ABU DHABI"
},
{
"Id": 15109,
"Code": "AEKLF",
"Name": "KHOR AL FAKKAN"
},
{
"Id": 15001,
"Code": "AERKT",
"Name": "RAS AL KHAIMAH"
},
{
"Id": 16018,
"Code": "AESHJ",
"Name": "SHARJAH"
},
{
"Id": 14863,
"Code": "AEQIW",
"Name": "UMM AL QAIWAIN"
},
{
"Id": 15647,
"Code": "AEFJR",
"Name": "AL - FUJAYRAH"
}
]
},
{
"Id": 12018,
"Code": "OM",
"Name": "OMAN",
"PortList": [
{
"Id": 6011,
"Code": "OMSLL",
"Name": "SALALAH"
},
{
"Id": 16218,
"Code": "OMSOH",
"Name": "SOHAR"
}
]
},
{
"Id": 10069,
"Code": "BH",
"Name": "BAHRAIN",
"PortList": [
{
"Id": 15345,
"Code": "BHKBS",
"Name": "BAHRAIN"
}
]
},
{
"Id": 62292,
"Code": "IQ",
"Name": "IRAQ",
"PortList": [
{
"Id": 15383,
"Code": "IQBSR",
"Name": "BASRA"
},
{
"Id": 14673,
"Code": "IQUQR",
"Name": "UMM QASR PT"
}
]
},
{
"Id": 62291,
"Code": "IR",
"Name": "IRAN, ISLAMIC REPUBLIC OF",
"PortList": [
{
"Id": 15250,
"Code": "IRBKM",
"Name": "BANDAR KHOMEINI"
},
{
"Id": 15249,
"Code": "IRBND",
"Name": "BANDAR ABBAS"
},
{
"Id": 14973,
"Code": "IRBUZ",
"Name": "BUSHEHR"
},
{
"Id": 14671,
"Code": "IRKHO",
"Name": "KHORRAMSHAHR"
}
]
},
{
"Id": 62306,
"Code": "KW",
"Name": "KUWAIT",
"PortList": [
{
"Id": 15810,
"Code": "KWSAA",
"Name": "SHUAIBA"
},
{
"Id": 15811,
"Code": "KWSWK",
"Name": "SHUWAIKH"
}
]
},
{
"Id": 12002,
"Code": "SA",
"Name": "SAUDI ARABIA",
"PortList": [
{
"Id": 15039,
"Code": "SAJUB",
"Name": "JUBAIL"
},
{
"Id": 16147,
"Code": "SADMM",
"Name": "AD DAMMAM"
}
]
},
{
"Id": 62364,
"Code": "QA",
"Name": "QATAR",
"PortList": [
{
"Id": 15739,
"Code": "QADOH",
"Name": "DOHA"
},
{
"Id": 14795,
"Code": "QAMES",
"Name": "MESAIEED"
}
]
}
]
}
],
"CountryList": [
]
},
{
"Id": 30,
"Name": "RED SEA",
"RegionList": [
{
"Id": 65,
"Name": "RED SEA",
"RegionList": [
],
"CountryList": [
]
}
],
"CountryList": [
{
"Id": 12002,
"Code": "SA",
"Name": "SAUDI ARABIA",
"PortList": [
{
"Id": 6003,
"Code": "SAKAC",
"Name": "KING ABDULLAH PORT"
},
{
"Id": 15731,
"Code": "SAJED",
"Name": "JEDDAH"
}
]
},
{
"Id": 10114,
"Code": "DJ",
"Name": "DJIBOUTI",
"PortList": [
{
"Id": 8059,
"Code": "DJJIB",
"Name": "DJIBOUTI"
}
]
},
{
"Id": 10122,
"Code": "ER",
"Name": "ERITREA",
"PortList": [
{
"Id": 15031,
"Code": "ERMSW",
"Name": "MASSAWA"
}
]
},
{
"Id": 62300,
"Code": "JO",
"Name": "JORDAN",
"PortList": [
{
"Id": 14801,
"Code": "JOAQJ",
"Name": "AL \u0027AQABAH"
}
]
},
{
"Id": 50001,
"Code": "SD",
"Name": "sd",
"PortList": [
{
"Id": 15734,
"Code": "SDPZU",
"Name": "PORT SUDAN"
}
]
},
{
"Id": 62425,
"Code": "YE",
"Name": "YEMEN",
"PortList": [
{
"Id": 15302,
"Code": "YEHOD",
"Name": "HODEIDAH"
},
{
"Id": 15304,
"Code": "YEMKX",
"Name": "MUKALLA"
},
{
"Id": 15300,
"Code": "YEADE",
"Name": "ADEN"
}
]
},
{
"Id": 10118,
"Code": "EG",
"Name": "EGYPT",
"PortList": [
{
"Id": 16030,
"Code": "EGSOK",
"Name": "SOKHNA PORT"
}
]
}
]
}
],
"CountryList": [
]
}
]