Related
I have used Angular as programming language for my project and i am a beginner. But i am stuck at the point where i have to generate PDF of my JSON response.
Looked at the documentation of PDFMAKE to achieve the same, but couldnot figure out how to implement it and come out with the output as shown in following image.
Output Structure Image
The JSON response is as follows:
{
"statusCode": true,
"data": [
{
"partyId": 1,
"partyIdDisp": "1/PA/2077",
"createdDate": "2077/05/03",
"partyName": "Roshan Basnet",
"contactNumber": 9841040791,
"companyName": "Butwal Poultry",
"panNumber": 321654,
"address": "Butwal, Nepal",
"saleDetails": [
{
"_id": "5f5b234cbac67e377c2a700f",
"saleId": 1,
"saleIdDisp": "1/S/2077",
"createdDate": "2077/05/26",
"saleType": "Credit",
"customerId": 1,
"customerName": "Roshan Basnet",
"contactNumber": 9841040791,
"billingName": "Butwal Poultry",
"billingAddress": "Butwal, Nepal",
"billDate": "2077/05/26",
"itemDetails": [
{
"_id": "5f5b234cbac67e377c2a7010",
"itemId": 1,
"itemName": "Chicken",
"quantity": 10,
"unit": "KG",
"piece": 5,
"receiptNo": null,
"billNo": 366,
"unitPrice": 310,
"itemAmount": 3100
}
],
"totalQuantity": 10,
"paymentMethod": "Cash",
"subTotal": 3100,
"amountInWords": "three thousand one hundred only",
"outstandingBalance": 0,
"receivedAmount": 3000,
"balanceAmount": 100,
"__v": 0
},
{
"_id": "5f5b2375bac67e377c2a7012",
"saleId": 2,
"saleIdDisp": "2/S/2077",
"createdDate": "2077/05/26",
"saleType": "Credit",
"customerId": 1,
"customerName": "Roshan Basnet",
"contactNumber": 9841040791,
"billingName": "Butwal Poultry",
"billingAddress": "Butwal, Nepal",
"billDate": "2077/05/26",
"itemDetails": [
{
"_id": "5f5b2375bac67e377c2a7013",
"itemId": 2,
"itemName": "Mutton",
"quantity": 5,
"unit": "KG",
"piece": 0,
"receiptNo": null,
"billNo": 266,
"unitPrice": 1200,
"itemAmount": 6000
},
{
"_id": "5f5b2375bac67e377c2a7014",
"itemId": 3,
"itemName": "Eggs",
"quantity": 10,
"unit": "Crate",
"piece": 0,
"receiptNo": null,
"billNo": 366,
"unitPrice": 390,
"itemAmount": 3900
}
],
"totalQuantity": 15,
"paymentMethod": "Cash",
"subTotal": 10000,
"amountInWords": "ten thousand only",
"outstandingBalance": 100,
"receivedAmount": 5000,
"balanceAmount": 5000,
"__v": 0
}
]
}
]
}
A code snippet how to generate a pdf output as per the structure in the image would be helpful.
In Model Derivative API (OBJ Extraction using DbIds), I retrieved OBJ URN using API. As Response shows below, it returns all children's URN for obj, mtl, and its zip. How do we identify the recent extraction as every child does have its own guid?
I have attached whole response JSON. What I am looking for is the second obj file which has extracted using several dbids like "17,19,21,22,23...". The first child obj was created long ago. How do I differentiate the new obj. As GUID's are different for every node. How do I identify which GUID.obj belongs to my desired extraction.
** Edited **
I am looking for identifying extracted wavefronts object files( not objectids and name which gets from metadata). Suppose if I extracted 2 object files from one model, then after completion of object file geometry extraction job, 6 file gets generated and store in bucket.
first .obj (guid = /output/geometry/e72fa6b3-4fc2-3c86-8424-5d0755539c0d.obj)
first .mtl
first .zip
second .obj
second .mtl
second .zip
Every file does have different GUID.Type as name. and those guid's are random and never shown while calling of extraction API or while getting its progress.
these are shown in below JSON file. Now suppose I extracted 10 different object files from one model. that means in bucket 30 new file URN will be generated.
And it is getting very hard to identify.
The Solution could have been if I extract obj geometry from model, I should get that particular obj, mtl, zips guid. IF I am getting only 3 ids then I can map those and download it from bucket.
What is happening now is I am getting all obj's guid (suppose 30 ) after calling get manifest GET :urn/manifest . And I am not understanding what obj file belong to which extraction.
{
"type": "manifest",
"hasThumbnail": "true",
"status": "success",
"progress": "complete",
"region": "US",
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA",
"version": "1.0",
"derivatives": [{
"name": "rme_advanced_sample_project.nwd",
"hasThumbnail": "true",
"status": "success",
"progress": "complete",
"outputType": "svf",
"children": [{
"guid": "763d96f1-0812-451d-b3a1-a51a27eba53b",
"name": "rme_advanced_sample_project.rvt",
"hasThumbnail": "true",
"role": "3d",
"viewableID": "rme_advanced_sample_project.rvt",
"progress": "complete",
"useAsDefault": true,
"status": "success",
"type": "geometry",
"children": [{
"guid": "1e172e73-2305-4eb8-9954-eeab8217a8d3",
"name": "Default",
"hasThumbnail": "true",
"role": "3d",
"camera": [-86.09573364257812, -79.89456176757812, 139.12220764160156, 70.56798553466797, 76.76915740966797, -17.541505813598633, 0.40824830532073975, 0.40824830532073975, 0.8164966106414795, 1.664323329925537, 0.785398006439209, 1, 0],
"useAsDefault": true,
"status": "success",
"type": "view",
"children": [{
"guid": "f2054c5f-10b8-457b-a927-23b69107dcd7",
"role": "thumbnail",
"mime": "image/png",
"resolution": [100, 100],
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/0_100.png",
"type": "resource"
}, {
"guid": "20625548-d014-4d29-8e50-4d61a1759a60",
"role": "thumbnail",
"mime": "image/png",
"resolution": [200, 200],
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/0_200.png",
"type": "resource"
}, {
"guid": "48675a6a-f2ec-4748-b22c-200b72cd06a8",
"role": "thumbnail",
"mime": "image/png",
"resolution": [400, 400],
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/0_400.png",
"type": "resource"
}]
}, {
"guid": "77850512-9e8b-4d09-bb1a-45706ad5b7e6",
"name": "3D View",
"hasThumbnail": "false",
"role": "viewable",
"progress": "0% complete",
"status": "success",
"type": "folder",
"children": [{
"guid": "ebf9f756-6cfa-4858-9787-e3af9c8424c3",
"name": "3D Duct & Equipment",
"role": "3d",
"camera": [61.56271743774414, 38.53883743286133, 9.783880233764648, 59.46215057373047, 40.639404296875, 7.683313846588135, -0.40824830532073975, 0.40824830532073975, 0.8164966106414795, 1, 45, 227.96743774414062, 1],
"status": "success",
"type": "view"
}, {
"guid": "54d5a270-f330-4446-a482-1079312d8518",
"name": "Main Electrical Distribution",
"role": "3d",
"camera": [91.54497528076172, -63.42673110961914, -34.64605712890625, 46.680015563964844, 38.5232048034668, -66.7026596069336, -0.11140129715204239, 0.25314533710479736, 0.9609928131103516, 1, 45, 342.1146545410156, 1],
"status": "success",
"type": "view"
}, {
"guid": "2c6938f2-c052-4195-93d0-adc7af1cb965",
"name": "3D Plumbing",
"role": "3d",
"camera": [3.6063644886016846, -184.62478637695312, 180.24473571777344, 173.09983825683594, -2.4171712398529053, -0.014680136926472187, 0.39955270290374756, 0.42952418327331543, 0.8098559379577637, 1, 45, 461.8291931152344, 1],
"status": "success",
"type": "view"
}, {
"guid": "1b3f6ae4-beb6-478c-9cfe-b83bf371141d",
"name": "Room 53 3D Fire Protection",
"role": "3d",
"camera": [735.119384765625, -538.998779296875, 662.6300048828125, 98.2931900024414, 97.82740020751953, 25.80381202697754, -0.40824830532073975, 0.40824830532073975, 0.8164966106414795, 1, 45, 368.90972900390625, 1],
"status": "success",
"type": "view"
}, {
"guid": "45811cc4-79ed-421b-82b2-6c8548d1507e",
"name": "WSHP 2-3 System View",
"role": "3d",
"camera": [108.588134765625, 117.7073974609375, 54.383365631103516, 102.33130645751953, 123.9642333984375, 48.12653350830078, -0.40824830532073975, 0.40824830532073975, 0.8164966106414795, 1, 45, 333.1808776855469, 1],
"status": "success",
"type": "view"
}, {
"guid": "8c1402a9-6af6-47af-af0d-2c025ca26109",
"name": "Plumbing Isometric - Domestic Water",
"role": "3d",
"camera": [3.6063644886016846, -184.62478637695312, 180.24473571777344, 173.09983825683594, -2.4171712398529053, -0.014680136926472187, 0.39955270290374756, 0.42952418327331543, 0.8098559379577637, 1, 45, 461.8291931152344, 1],
"status": "success",
"type": "view"
}, {
"guid": "9dcc0f6a-fc2c-418f-8d08-c99b7afed337",
"name": "Plumbing Isometric - Sanitary Waste",
"role": "3d",
"camera": [3.6063644886016846, -184.62478637695312, 180.24473571777344, 173.09983825683594, -2.4171712398529053, -0.014680136926472187, 0.39955270290374756, 0.42952418327331543, 0.8098559379577637, 1, 45, 461.8291931152344, 1],
"status": "success",
"type": "view"
}, {
"guid": "e3a2443a-7f4c-49dc-a41d-da067922ab04",
"name": "Typical Make Up Air Isometric Detail",
"role": "3d",
"camera": [0.8279496431350708, 187.99771118164062, 118.81455993652344, 100.31283569335938, 88.51282501220703, 19.32967758178711, 0.40824830532073975, -0.40824830532073975, 0.8164966106414795, 1, 45, 248.74505615234375, 1],
"status": "success",
"type": "view"
}, {
"guid": "915564b9-ed83-426e-88df-002dac32363b",
"name": "Typical Room WSHP",
"role": "3d",
"camera": [171.6078338623047, -3.038959264755249, 18.71452522277832, 90.31718444824219, 43.15993118286133, -21.66922950744629, -0.34472253918647766, 0.19591180980205536, 0.9180331826210022, 1, 45, 257.0640869140625, 1],
"status": "success",
"type": "view"
}, {
"guid": "12a3ef04-1364-4c23-af91-2679132e3848",
"name": "Toilet Room",
"role": "3d",
"camera": [196.7369842529297, -4.305071830749512, 109.12708282470703, 98.9510269165039, 86.86759948730469, 14.070858001708984, -0.42381933331489563, 0.3951563239097595, 0.8150022625923157, 1, 45, 359.9964294433594, 1],
"status": "success",
"type": "view"
}, {
"guid": "9a34ab86-dfdf-4516-a087-b8f9775435fe",
"name": "1st Level Slice",
"role": "3d",
"camera": [-76.2143325805664, -163.60708618164062, 175.46923828125, 111.73212432861328, 69.6202392578125, 11.465206146240234, 0.3013473451137543, 0.373949259519577, 0.8771269917488098, 1, 45, 313.0205993652344, 1],
"status": "success",
"type": "view"
}, {
"guid": "09effac0-27ac-4f02-b4d7-31ef18a57ef9",
"name": "{3D}",
"role": "3d",
"camera": [0.8279496431350708, 187.99771118164062, 118.81455993652344, 100.31283569335938, 88.51282501220703, 19.32967758178711, 0.40824830532073975, -0.40824830532073975, 0.8164966106414795, 1, 45, 358.7159118652344, 1],
"status": "success",
"type": "view"
}]
}, {
"guid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
"role": "graphics",
"mime": "application/autodesk-svf",
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/0.svf",
"type": "resource"
}]
}, {
"guid": "3b7195a7-17ec-4d80-b259-4e9df165f3fb",
"role": "Autodesk.CloudPlatform.PropertyDatabase",
"mime": "application/autodesk-db",
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/0/properties.db",
"status": "success",
"type": "resource"
}]
}, {
"hasThumbnail": "false",
"status": "success",
"progress": "complete",
"outputType": "obj",
"children": [{
"guid": "22519ef5-9da5-35ca-bc70-b25b45e8f8fa",
"role": "obj",
"modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
"objectIds": [547, 924, 942, 977],
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/e72fa6b3-4fc2-3c86-8424-5d0755539c0d.obj",
"status": "success",
"type": "resource"
}, {
"guid": "75401422-bb33-350a-aa10-05625504d6ca",
"role": "obj",
"modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
"objectIds": [547, 924, 942, 977],
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/e72fa6b3-4fc2-3c86-8424-5d0755539c0d.mtl",
"status": "success",
"type": "resource"
}, {
"guid": "a4b9fb43-8525-3243-bde1-72797399e342",
"role": "obj",
"modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
"objectIds": [547, 924, 942, 977],
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/e72fa6b3-4fc2-3c86-8424-5d0755539c0d.zip",
"status": "success",
"type": "resource"
}, {
"guid": "1177e7ea-7fad-34b7-a7bd-23d70e4a62a8",
"type": "resource",
"role": "obj",
"modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
"objectIds": [17, 19, 21, 22, 23, 24, 25, 26, 27, 83, 84, 85, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 263, 264, 265, 268, 269, 270, 302, 303, 304, 320, 321, 322, 350, 351, 352, 370, 371],
"status": "success",
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/a08e65e7-082a-3ce1-8116-ae534c9f081d.obj"
}, {
"guid": "61acd067-4637-3549-9bd3-cd362a4fb93b",
"type": "resource",
"role": "obj",
"modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
"objectIds": [17, 19, 21, 22, 23, 24, 25, 26, 27, 83, 84, 85, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 263, 264, 265, 268, 269, 270, 302, 303, 304, 320, 321, 322, 350, 351, 352, 370, 371],
"status": "success",
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/a08e65e7-082a-3ce1-8116-ae534c9f081d.mtl"
}, {
"guid": "6c73254c-7bbf-312a-a481-aaeebdf53de3",
"type": "resource",
"role": "obj",
"modelGuid": "f9f4721d-9304-43c4-8c07-34cbcc5e79c7",
"objectIds": [17, 19, 21, 22, 23, 24, 25, 26, 27, 83, 84, 85, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 263, 264, 265, 268, 269, 270, 302, 303, 304, 320, 321, 322, 350, 351, 352, 370, 371],
"status": "success",
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZXh0cmFjdC1hdXRvZGVzay1pby0yMDE3MnVvbm5paWJkd2t1Z25ydGVvZGFjN2FpeWhwdjdrd20vcm1lX2FkdmFuY2VkX3NhbXBsZV9wcm9qZWN0Lm53ZA/output/geometry/a08e65e7-082a-3ce1-8116-ae534c9f081d.zip"
}]
}]
}
Use GET :urn/metadata to obtain a list of model views:
{
"data": {
"type": "metadata",
"metadata": [
{
"name": "Scene",
"role": "3d",
"guid": "4f981e94-8241-4eaf-b08b-cd337c6b8b1f",
},
{
"name": "Sheet: A101",
"role": "2d",
"guid": "8e7c6bca-cfd1-290e-4b16-f3670169bb71"
}
]
}
}
Then use GET :urn/metadata/:guid to retrieve the object tree to identify your derivatives:
{
"data": {
"type": "objects",
"objects": [
{
"objectid": 1,
"name": "A5",
"objects": [
{
"objectid": 2,
"name": "Model",
"objects": [
{
"objectid": 3,
"name": "Bottom",
"objects": [
{
"objectid": 4,
"name": "Box"
}
]
},
I have the following code which I am using to filter one nested array with values from another nested array, but I am looking for the more fastest method.
const length = this.addedStateItems.length;
for (let i = 0; i < length; i++) {
if (this.addedStateItems[i].cities.length > 0) {
const tempCity: Array<BWCity> = [];
for (let k = 0; k < addedStates.length; k++) {
for (let l = 0; l < addedStates[k].Cities.length; l++) {
const city = this.addedStateItems[i].cities.find(item =>
item.name.toUpperCase().split(' ').join('_') === addedStates[k].Cities[l].CityName
);
if (city) {
tempCity.push(city);
}
}
}
this.addedStateItems[i].cities = tempCity;
}
}
JSON sample is as below:
this.addedStateItems = [
{
"isSelected": false,
"cities": [],
"name": "Alabama",
"code": "AL",
"sequence": 2,
"access": 2,
"id": 2
},
{
"isSelected": false,
"cities": [],
"name": "Alaska",
"code": "AK",
"sequence": 3,
"access": 3,
"id": 3
},
{
"isSelected": false,
"cities": [],
"name": "Arizona",
"code": "AZ",
"sequence": 4,
"access": 4,
"id": 4
},
{
"isSelected": false,
"cities": [],
"name": "Arkansas",
"code": "AR",
"sequence": 5,
"access": 5,
"id": 5
},
{
"isSelected": false,
"cities": [],
"name": "California",
"code": "CA",
"sequence": 6,
"access": 6,
"id": 6
},
{
"isSelected": false,
"cities": [],
"name": "Colorado",
"code": "CO",
"sequence": 7,
"access": 7,
"id": 7
},
{
"isSelected": false,
"cities": [],
"name": "Connecticut",
"code": "CT",
"sequence": 8,
"access": 8,
"id": 8
},
{
"isSelected": false,
"cities": [],
"name": "Delaware",
"code": "DE",
"sequence": 9,
"access": 9,
"id": 9
},
{
"isSelected": false,
"cities": [],
"name": "District of Columbia",
"code": "DC",
"sequence": 10,
"access": 10,
"id": 10
},
{
"isSelected": false,
"cities": [],
"name": "Florida",
"code": "FL",
"sequence": 11,
"access": 11,
"id": 11
},
{
"isSelected": false,
"cities": [],
"name": "Georgia",
"code": "GA",
"sequence": 12,
"access": 12,
"id": 12
},
{
"isSelected": false,
"cities": [],
"name": "Hawaii",
"code": "HI",
"sequence": 13,
"access": 13,
"id": 13
},
{
"isSelected": false,
"cities": [],
"name": "Idaho",
"code": "ID",
"sequence": 14,
"access": 14,
"id": 14
},
{
"isSelected": false,
"cities": [],
"name": "Illinois",
"code": "IL",
"sequence": 15,
"access": 15,
"id": 15
},
{
"isSelected": false,
"cities": [],
"name": "Indiana",
"code": "IN",
"sequence": 16,
"access": 16,
"id": 16
},
{
"isSelected": false,
"cities": [],
"name": "Iowa",
"code": "IA",
"sequence": 17,
"access": 17,
"id": 17
},
{
"isSelected": false,
"cities": [],
"name": "Kansas",
"code": "KS",
"sequence": 18,
"access": 18,
"id": 18
},
{
"isSelected": false,
"cities": [],
"name": "Kentucky",
"code": "KY",
"sequence": 19,
"access": 19,
"id": 19
},
{
"isSelected": false,
"cities": [],
"name": "Louisiana",
"code": "LA",
"sequence": 20,
"access": 20,
"id": 20
},
{
"isSelected": false,
"cities": [],
"name": "Maine",
"code": "ME",
"sequence": 21,
"access": 21,
"id": 21
},
{
"isSelected": false,
"cities": [],
"name": "Maryland",
"code": "MD",
"sequence": 22,
"access": 22,
"id": 22
},
{
"isSelected": false,
"cities": [],
"name": "Massachusetts",
"code": "MA",
"sequence": 23,
"access": 23,
"id": 23
},
{
"isSelected": false,
"cities": [
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 9
}
],
"name": "MI Generic",
"code": "MIG",
"id": 1
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 10
}
],
"name": "Port Huron",
"code": "POH",
"id": 9
},
{
"isSelected": false,
"citySequences": [],
"name": "Hudson",
"code": "HUD",
"id": 31
}
],
"name": "Michigan",
"code": "MI",
"sequence": 24,
"access": 24,
"id": 24
},
{
"isSelected": false,
"cities": [],
"name": "Minnesota",
"code": "MN",
"sequence": 25,
"access": 25,
"id": 25
},
{
"isSelected": false,
"cities": [],
"name": "Mississippi",
"code": "MS",
"sequence": 26,
"access": 26,
"id": 26
},
{
"isSelected": false,
"cities": [
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 1
}
],
"name": "Kansas City",
"code": "KCM",
"id": 29
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 2
}
],
"name": "St Louis",
"code": "STL",
"id": 30
}
],
"name": "Missouri",
"code": "MO",
"sequence": 27,
"access": 27,
"id": 27
},
{
"isSelected": false,
"cities": [],
"name": "Montana",
"code": "MT",
"sequence": 28,
"access": 28,
"id": 28
},
{
"isSelected": false,
"cities": [],
"name": "Nebraska",
"code": "NE",
"sequence": 29,
"access": 29,
"id": 29
},
{
"isSelected": false,
"cities": [],
"name": "New Hampshire",
"code": "NH",
"sequence": 31,
"access": 31,
"id": 31
},
{
"isSelected": false,
"cities": [],
"name": "New Jersey",
"code": "NJ",
"sequence": 32,
"access": 32,
"id": 32
},
{
"isSelected": false,
"cities": [],
"name": "New Mexico",
"code": "NM",
"sequence": 33,
"access": 33,
"id": 33
},
{
"isSelected": false,
"cities": [
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 1
},
{
"systemId": 3,
"sequence": 1
},
{
"systemId": 4,
"sequence": 1
},
{
"systemId": 5,
"sequence": 1
}
],
"name": "New York City",
"code": "NYC",
"id": 11
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 2
},
{
"systemId": 2,
"sequence": 1
}
],
"name": "Yonkers",
"code": "NYY",
"id": 12
}
],
"name": "New York",
"code": "NY",
"sequence": 34,
"access": 34,
"id": 34
},
{
"isSelected": false,
"cities": [],
"name": "North Carolina",
"code": "NC",
"sequence": 35,
"access": 35,
"id": 36
},
{
"isSelected": false,
"cities": [],
"name": "North Dakota",
"code": "ND",
"sequence": 36,
"access": 36,
"id": 37
},
{
"isSelected": false,
"cities": [
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 12
},
{
"systemId": 3,
"sequence": 3
},
{
"systemId": 4,
"sequence": 3
},
{
"systemId": 5,
"sequence": 3
}
],
"name": "OH Generic",
"code": "OHG",
"id": 13
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 1
},
{
"systemId": 3,
"sequence": 1
},
{
"systemId": 4,
"sequence": 1
},
{
"systemId": 5,
"sequence": 1
}
],
"name": "OH RITA",
"code": "OHR",
"id": 14
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 2
},
{
"systemId": 3,
"sequence": 2
},
{
"systemId": 4,
"sequence": 2
},
{
"systemId": 5,
"sequence": 2
}
],
"name": "OH CCA",
"code": "CCA",
"id": 15
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 3
}
],
"name": "Akron",
"code": "AKR",
"id": 16
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 4
}
],
"name": "Cincinnati",
"code": "CIN",
"id": 17
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 6
}
],
"name": "Columbus",
"code": "COL",
"id": 19
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 7
}
],
"name": "Toledo",
"code": "TOL",
"id": 20
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 8
}
],
"name": "Springfield",
"code": "SPR",
"id": 21
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 9
}
],
"name": "Wyoming",
"code": "WYO",
"id": 22
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 10
}
],
"name": "Indian_Hill",
"code": "IHL",
"id": 23
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 11
}
],
"name": "Mansfield",
"code": "MAN",
"id": 24
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 12
}
],
"name": "Crestline",
"code": "CRE",
"id": 25
}
],
"name": "Ohio",
"code": "OH",
"sequence": 37,
"access": 37,
"id": 38
},
{
"isSelected": false,
"cities": [],
"name": "Oklahoma",
"code": "OK",
"sequence": 38,
"access": 38,
"id": 39
},
{
"isSelected": false,
"cities": [],
"name": "Oregon",
"code": "OR",
"sequence": 39,
"access": 39,
"id": 40
},
{
"isSelected": false,
"cities": [
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 1
}
],
"name": "PA Generic",
"code": "PAG",
"id": 26
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 2
},
{
"systemId": 2,
"sequence": 1
},
{
"systemId": 3,
"sequence": 1
},
{
"systemId": 4,
"sequence": 1
},
{
"systemId": 5,
"sequence": 1
}
],
"name": "Philadelphia",
"code": "PHI",
"id": 27
}
],
"name": "Pennsylvania",
"code": "PA",
"sequence": 40,
"access": 40,
"id": 41
},
{
"isSelected": false,
"cities": [],
"name": "Rhode Island",
"code": "RI",
"sequence": 41,
"access": 41,
"id": 42
},
{
"isSelected": false,
"cities": [],
"name": "South Carolina",
"code": "SC",
"sequence": 42,
"access": 42,
"id": 43
},
{
"isSelected": false,
"cities": [],
"name": "Tennessee",
"code": "TN",
"sequence": 44,
"access": 44,
"id": 45
},
{
"isSelected": false,
"cities": [],
"name": "Texas",
"code": "TX",
"sequence": 45,
"access": 45,
"id": 46
},
{
"isSelected": false,
"cities": [],
"name": "Utah",
"code": "UT",
"sequence": 46,
"access": 46,
"id": 47
},
{
"isSelected": false,
"cities": [],
"name": "Vermont",
"code": "VT",
"sequence": 47,
"access": 47,
"id": 48
},
{
"isSelected": false,
"cities": [],
"name": "Virginia",
"code": "VA",
"sequence": 48,
"access": 48,
"id": 49
},
{
"isSelected": false,
"cities": [],
"name": "West Virginia",
"code": "WV",
"sequence": 50,
"access": 50,
"id": 51
},
{
"isSelected": false,
"cities": [],
"name": "Wisconsin",
"code": "WI",
"sequence": 51,
"access": 51,
"id": 52
}
]
Second JSON:
addedStates = [
{
"StateName": "DISTRICT_OF_COLUMBIA",
"Cities": []
},
{
"StateName": "COLORADO",
"Cities": []
},
{
"StateName": "ALABAMA",
"Cities": []
},
{
"StateName": "OHIO",
"Cities": [
{
"CityName": "AKRON"
},
{
"CityName": "CINCINNATI"
}
]
},
{
"StateName": "NEW_YORK",
"Cities": [
{
"CityName": "YONKERS"
}
]
}
]
After filtering first JSON with second JSON I expect this:
result = [
{
"isSelected": false,
"cities": [],
"name": "Alabama",
"code": "AL",
"sequence": 2,
"access": 2,
"id": 2
},
{
"isSelected": false,
"cities": [],
"name": "Colorado",
"code": "CO",
"sequence": 7,
"access": 7,
"id": 7
},
{
"isSelected": false,
"cities": [],
"name": "District of Columbia",
"code": "DC",
"sequence": 10,
"access": 10,
"id": 10
},
{
"isSelected": false,
"cities": [
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 2
},
{
"systemId": 2,
"sequence": 1
}
],
"name": "Yonkers",
"code": "NYY",
"id": 12
}
],
"name": "New York",
"code": "NY",
"sequence": 34,
"access": 34,
"id": 34
},
{
"isSelected": false,
"cities": [
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 3
}
],
"name": "Akron",
"code": "AKR",
"id": 16
},
{
"isSelected": false,
"citySequences": [
{
"systemId": 1,
"sequence": 4
}
],
"name": "Cincinnati",
"code": "CIN",
"id": 17
}
],
"name": "Ohio",
"code": "OH",
"sequence": 37,
"access": 37,
"id": 38
}
]
I'm trying to fetch tid of a photo from SkyBiometry in a callback function as shown below, but it doesn't work.
function callback(data) {
drawFaces($("#conent_demo_image"), data.photos[0], true);
var tid = data.photos[0].tags[0].tid;
$("#tid").text(tid);
}
The html:
<div id="tid">
tid:
</div>
According to the source of SkyBiometry Demo it should be something like this:
{
"RawData": "...",
"Status": 0,
"photos": [{
"url": "https://skybiometry.com/Content/Samples/one_i.jpg",
"pid": "F#0ae0deaf6994b85e751943ae2166ec27_24412177fed2f",
"width": 480,
"height": 480,
"tags": [{
"tid": "TEMP_F#0ae0deaf6994b85e751943ae012b00ab_24412177fed2f_62.29_35.62_0_1",
"recognizable": true,
"uids": [],
"label": null,
"confirmed": false,
"manual": false,
"width": 20.83,
"height": 20.83,
"center": {"x": 62.29, "y": 35.62},
"eye_left": {"x": 68.54, "y": 30.42, "confidence": 57, "id": 449},
"eye_right": {"x": 56.67, "y": 30.42, "confidence": 55, "id": 450},
"mouth_center": {"x": 62.5, "y": 42.92, "confidence": 54, "id": 615},
"nose": {"x": 63.33, "y": 37.71, "confidence": 51, "id": 403},
"yaw": -6.0,
"roll": -1.0,
"pitch": 0.0,
"attributes": {
"face": {"value": true, "confidence": 70},
"gender": {"Value": 1, "value": "female", "confidence": 75},
"glasses": {"value": false, "confidence": 81},
"dark_glasses": {"value": false, "confidence": 58},
"smiling": {"value": true, "confidence": 100},
"age_est": {"value": 16, "confidence": 50},
"mood": {"Value": 2, "value": "happy", "confidence": 76},
"lips": {"Value": 1, "value": "parted", "confidence": 100},
"eyes": {"Value": 0, "value": "open", "confidence": 87},
"neutral_mood": {"value": false, "confidence": 0},
"anger": {"value": false, "confidence": 45},
"disgust": {"value": false, "confidence": 1},
"fear": {"value": false, "confidence": 0},
"happiness": {"value": true, "confidence": 76},
"sadness": {"value": false, "confidence": 2},
"surprise": {"value": false, "confidence": 6}
},
"points": null,
"similarities": null
}]
}],
"status": "success",
"usage": {
"ResetTime": "2015-11-07T20:02:54Z",
"used": 21633,
"reset_time_text": "Sat, 7 November 2015 20:02:54 +0000",
"remaining": 78367,
"namespace_used": 0,
"limit": 100000,
"namespace_remaining": 0,
"reset_time": 1446926574,
"namespace_limit": 0
},
"operation_id": "c869d8e95f364f979dd62277810b299c"
}
What is the way to remove an property named "itemType"from the below given object
?
{
"id": 19,
"cost": 10,
"items": 10,
"numbers": 10,
"status": false,
"hours": 10,
"itemType": {
"id": 16,
"name": "PC 350",
"description": "PC 350"
},
"typeid": 12
}
So that the final array should look like
{
"id": 19,
"cost": 10,
"items": 10,
"numbers": 10,
"status": false,
"hours": 10,
"typeid": 12
}
This is object not array. You can use delete like this
var obj = {
"id": 19,
"cost": 10,
"items": 10,
"numbers": 10,
"status": false,
"hours": 10,
"itemType": {
"id": 16,
"name": "PC 350",
"description": "PC 350"
},
"typeid": 12
}
delete obj.itemType;
Whether it is an object and you want to delete a property from it, or you have an array and want to delete a value, the way to delete is -
delete obj.itemType //object.
delete array[3] //delete 4th item from the array.
Note - the structure you have provided is not an array, its an object.