Need assistance concatenating a string request together in JavaScript - javascript

In JavaScript I am sending an https request to a server. I receive the data back I am looking for but it comes in batches. Depending on the size of the data I'm requesting could be from 2-50 different batches. I need to get them all together so I can parse and pull the data I need from an array. The data I receive is pasted below. You can see there is a date and time stamp at the beginning of the first batch and another after "rows":. Those are added by the debugger I am using which is how I know they come in separate. My question is:
1) How do i get the strings concatenated together
2) Which is the best way to get in an array so I can choose the data I want?
2018 - 03 - 08 T21: 09: 18.913 Z f657fe40 - 2314 - 11e8 - 8273 - 19289 d6ed567 {
"id": 12345678,
"name": "Dummy sheet",
"version": 1,
"totalRowCount": 1,
"accessLevel": "ADMIN",
"effectiveAttachmentOptions": ["BOX_COM", "GOOGLE_DRIVE", "FILE", "EGNYTE", "ONEDRIVE", "DROPBOX", "EVERNOTE"],
"ganttEnabled": false,
"dependenciesEnabled": false,
"resourceManagementEnabled": false,
"cellImageUploadEnabled": true,
"userSettings": {
"criticalPathEnabled": false,
"displaySummaryTasks": true
},
"permalink": "https://app.smartsheet.com/b/home?lx=rxeuvsB26BVmyEpa6OYxUA",
"createdAt": "2018-03-06T14:29:32Z",
"modifiedAt": "2018-03-06T14:51:59Z",
"columns": [{
"id": 3114821425096580,
"index": 0,
"title": "Primary Column",
"type": "TEXT_NUMBER",
"primary": true,
"validation": false,
"width": 150
}, {
"id": 7618421052467076,
"index": 1,
"title": "Column2",
"type": "TEXT_NUMBER",
"validation": false,
"width": 150
}, {
"id": 1988921518253956,
"index": 2,
"title": "Column3",
"type": "TEXT_NUMBER",
"validation": false,
"width": 150
}, {
"id": 6492521145624452,
"index": 3,
"title": "Column4",
"type": "TEXT_NUMBER",
"validation": false,
"width": 150
}, {
"id": 4240721331939204,
"index": 4,
"title": "Column5",
"type": "TEXT_NUMBER",
"validation": false,
"width": 150
}, {
"id": 8744320959309700,
"index": 5,
"title": "Column6",
"type": "TEXT_NUMBER",
"validation": false,
"width": 150
}],
"rows": 2018 - 03 - 08 T21: 09: 18.932 Z f657fe40 - 2314 - 11e8 - 8273 - 19289 d6ed567[{
"id": 573049024079748,
"rowNumber": 1,
"expanded": true,
"createdAt": "2018-03-06T14:51:59Z",
"modifiedAt": "2018-03-06T14:51:59Z",
"cells": [{
"columnId": 3114821425096580,
"value": 123456.0,
"displayValue": "$123,456.00"
}, {
"columnId": 7618421052467076
}, {
"columnId": 1988921518253956
}, {
"columnId": 6492521145624452
}, {
"columnId": 4240721331939204
}, {
"columnId": 8744320959309700
}]
}]
}

It's hard to tell from your description which strings you're trying to concatenate -- whole blobs of JSON, certain strings from within the JSON?
I can at least say that an efficient way to concatenate strings is to push them all into an array, then join the array into one string.
var builder = [];
builder.push(string1);
builder.push(string2);
builder.push(string3);
...
var result = builder.join('');
I'm not sure exactly what you mean by "get in an array" either, but if you're talking about turning all of one string into an array with each character as a individual item, string.split('') will do that.

Related

Trying to access object in Api array and count length

Trying to access the mythic object and print the length of mythic's that exist in the account but unsure how to access it as its nested in the array. Api output is below Javascript. Just not sure exactly what I can use to get its length as I used json.mythic.length and that did not work. And Thank you very much to anyone who is able to help me with this problem.
function MyFunction(e) {
e.preventDefault();
var username = document.getElementById("username").value
document.getElementById("search").innerHTML = username;
const data = {
username, limit: 3000, offset: 0, rarities: [], markers: [], onSale: "", search: "" }
fetch("https://prod-eternal-backend.onrender.com/api/v1/moment/list" ,{
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-type": "application/json; charset=UTF-8"
}
})
.then(response => {
return response.json();
})
.then(json => {
console.log(json);
document.getElementById("moments").innerHTML ="Total Moments = " + json.moments.length;
var mythics = json.mythic.length * 50;
document.getElementById("gamer").innerHTML ="Gamer Score = " + mythics;
})
}
{
"moments": [
{
"id": 114375,
"playId": 536,
"setId": 16,
"serialNumber": 4,
"username": "pattonh84",
"userId": 1230,
"userAuthId": "AqXfuefDt5a5wfqAoIa45O1RKbd2",
"influencer": "YuggieTV",
"influencerId": "YuggieTV",
"influencerAvatar": "https://eternal-zelos.s3.us-west-2.amazonaws.com/influencers/YuggieTV_square.png",
"playbackId": "QXMRHp9R4uFcSsCQkN7mBCDbSmFZdImdjeUHypEutRw",
"rarity": "mythic",
"createdAt": "2021-10-25T00:11:54.734962Z",
"setName": "Flow State",
"circulationCount": 30,
"title": "How Strong Could It Be?",
"imageURL": "https://eternal-zelos.s3.us-west-2.amazonaws.com/images/FlowFest/Let+Me+See+How+Strong+It+Is.png",
"packName": "Flow State",
"clipDate": "2021-09-26T02:55:28Z",
"tags": [
"funny"
],
"description": "Yuggie doing experiments in the name of science. Today's experiment is about how strong a watermelon could be.",
"game": "IRL",
"twitter": "yuggietv",
"staked": false,
"autographStatus": "false",
"discordUtility": false,
"markers": null
},
{
"id": 108262,
"playId": 565,
"setId": 16,
"serialNumber": 1,
"username": "pattonh84",
"userId": 1230,
"userAuthId": "AqXfuefDt5a5wfqAoIa45O1RKbd2",
"influencer": "Amouranth",
"influencerId": "Amouranth",
"influencerAvatar": "https://eternal-zelos.s3.us-west-2.amazonaws.com/influencers/Amouranth.jpg",
"playbackId": "101L8XUOTCKkJW3USj6rtiJm5k4iTAwTIMqcxfPsr8QA",
"rarity": "mythic",
"createdAt": "2021-10-22T17:07:38.357172Z",
"setName": "Flow State",
"circulationCount": 30,
"title": "Mare Awareness",
"imageURL": "https://eternal-zelos.s3.us-west-2.amazonaws.com/images/FlowFest/amouranth+pretending+to+be+a+horse.png",
"packName": "Flow State",
"clipDate": "2021-09-26T04:21:46Z",
"tags": [
"funny"
],
"description": "Now a popular gif, this clip showcases a horse performance complete with galloping and internal monalogue.",
"game": "Just Chatting",
"twitter": "Amouranth",
"staked": false,
"autographStatus": "pending",
"autographRequestId": 2071,
"discordUtility": false,
"markers": null
},
{
"id": 114393,
"playId": 536,
"setId": 16,
"serialNumber": 22,
"username": "pattonh84",
"userId": 1230,
"userAuthId": "AqXfuefDt5a5wfqAoIa45O1RKbd2",
"influencer": "YuggieTV",
"influencerId": "YuggieTV",
"influencerAvatar": "https://eternal-zelos.s3.us-west-2.amazonaws.com/influencers/YuggieTV_square.png",
"playbackId": "QXMRHp9R4uFcSsCQkN7mBCDbSmFZdImdjeUHypEutRw",
"rarity": "mythic",
"createdAt": "2021-10-22T03:35:24.934307Z",
"setName": "Flow State",
"forSale": true,
"circulationCount": 30,
"price": 200,
"title": "How Strong Could It Be?",
"imageURL": "https://eternal-zelos.s3.us-west-2.amazonaws.com/images/FlowFest/Let+Me+See+How+Strong+It+Is.png",
"packName": "Flow State",
"clipDate": "2021-09-26T02:55:28Z",
"tags": [
"funny"
],
"description": "Yuggie doing experiments in the name of science. Today's experiment is about how strong a watermelon could be.",
"game": "IRL",
"twitter": "yuggietv",
"staked": false,
"autographStatus": "false",
"discordUtility": false,
"productId": 67358,
"markers": null
}
],
"totalMoments": 3
}
You are trying to access a mythic property on your JSON object, but your data does not have such a property. I would recommend that you study more on JSON structure and accessing properties in javascript.
Basically, json.mythics checks for a property called mythics in the root level of your json object, the same way json.moments does. If your data was organized like:
{
"moments": [...],
"mythics": [...]
}
then you would access it with json.mythics
But your json only has a moments array of objects, some of which have a rarity property set to "mythic".
Assuming you want to filter out these elements from the array, a simple filter should suffice:
const mythics = json.moments.filter(moment => moment.rarity === 'mythic');
mythics.length // gives the length of the 'mythics'

Javascript object nested filtering

I have an object parsed from JSON output.
I have to use only pure JS without any 3rd part libs. Can somebody suggest a working solution to filter a specific nested object by one of its key's value. In this sample I have a few "Fields" objects which contains also nested objects.
So is there a way to filter the whole nested object inside Fields using VName value as a filter criteria? For example use "VName": "oc_data" to filter the whole object inside Fields oc_data belongs to
[{
"Id": "0050560107dd",
"Name": "Demo Range",
"AllMup": false,
"Lines": [{
"Id": "0050560107dd",
"AllMup": false,
"Fields": [{
"Id": "0050560107dd",
"Name": "Some value here",
"VName": "oc_data",
"IsRequired": false,
"Format": {
"Type": "Dictionary",
"Dictionary": {
"Name": "Main stuff",
"SysName": "da3a45de77d1",
"ValuesUrl": "https://mysityurl.com",
"Id": "0050560107dd",
},
"CalForm": []
}
}]
},
{
"Id": "0050560107dd",
"AllMup": false,
"Fields": [{
"Id": "0050560107dd",
"Name": "Some value again",
"VName": "task_stat",
"IsRequired": false,
"Format": {
"Type": "Dictionary",
"Dictionary": {
"Name": "Task stuff",
"SysName": "Tasks.TaskState",
"ValuesUrl": "https://mysecondurl.com",
"Id": "ac1f6b17f99d",
},
"CalForm": []
}
}]
}
]
},
{
"Id": "0050560107dd",
"Name": "Demo Range",
"AllMup": false,
"Lines": [{
"Id": "0050560107dd",
"AllMup": false,
"Fields": [{
"Id": "0050560107dd",
"Name": "Category",
"IsRequired": false,
"Format": {
"Type": "Dictionary",
"Dictionary": {
"Name": "Some category",
"SysName": "LitigationCategory",
"ValuesUrl": "https://myempty.com",
"Id": "902b343a9588",
},
"CalForm": []
}
}]
}]
}
]

How to insert values of matching JSON Keys between 2 JSON files

I have 2 JSON files:
A Template JSON
A JSON output (from awscli)
The template is a small JSON file as below:
{
"DryRun": true,
"ImageId": "",
"KeyName": "",
"SecurityGroups": [
""
],
"InstanceType": "",
"Monitoring": {
"Enabled": false
},
"SubnetId": "",
"DisableApiTermination": true,
"PrivateIpAddress": "",
"IamInstanceProfile": {
"Arn": "",
"Name": ""
},
"EbsOptimized": true,
"TagSpecifications": [{
"ResourceType": "",
"Tags": [{
"Key": "",
"Value": ""
}]
}]
}
The original file is the output of aws ec2 describe-instances:
{
"Reservations": [{
"OwnerId": "123456789012",
"ReservationId": "r-12345678",
"Groups": [],
"Instances": [{
"Monitoring": {
"State": "disabled"
},
"PublicDnsName": "ec2-12-34-56-78.ap-southeast-1.compute.amazonaws.com",
"RootDeviceType": "ebs",
"State": {
"Code": 16,
"Name": "running"
},
"EbsOptimized": false,
"LaunchTime": "2016-02-09T03:06:21.000Z",
"PublicIpAddress": "12.34.56.78",
"PrivateIpAddress": "172.31.1.2",
"ProductCodes": [],
"VpcId": "vpc-1a2b3c4d",
"StateTransitionReason": "",
"InstanceId": "i-abcd1234",
"ImageId": "ami-1234abcd",
"PrivateDnsName": "ip-172-31-1-2.ap-southeast-1.compute.internal",
"KeyName": "tempKey",
"SecurityGroups": [{
"GroupName": "somegroup1",
"GroupId": "sg-ZZZZZ"
},
{
"GroupName": "somegroup2",
"GroupId": "sg-YYYYY"
}
],
"ClientToken": "NutKc123456789012",
"SubnetId": "subnet-00001234",
"InstanceType": "t2.medium",
"NetworkInterfaces": [{
"Status": "in-use",
"MacAddress": "02:AA:BB:CC:DD:EE",
"SourceDestCheck": true,
"VpcId": "vpc-1a2b3c4d",
"Description": "",
"Association": {
"PublicIp": "12.34.56.78",
"PublicDnsName": "ec2-12-34-56-78.ap-southeast-1.compute.amazonaws.com",
"IpOwnerId": "123456789012"
},
"NetworkInterfaceId": "eni-XXXXXXXX",
"PrivateIpAddresses": [{
"PrivateDnsName": "ip-172-31-1-2.ap-southeast-1.compute.internal",
"Association": {
"PublicIp": "1.2.3.4",
"PublicDnsName": "ec2-12-34-56-78.ap-southeast-1.compute.amazonaws.com",
"IpOwnerId": "123456789012"
},
"Primary": true,
"PrivateIpAddress": "172.31.1.2"
}],
"PrivateDnsName": "ip-172-31-1-2.ap-southeast-1.compute.internal",
"Attachment": {
"Status": "attached",
"DeviceIndex": 0,
"DeleteOnTermination": true,
"AttachmentId": "eni-attach-XXXXXXXX",
"AttachTime": "2016-01-13T08:33:37.000Z"
},
"Groups": [{
"GroupName": "somegroup1",
"GroupId": "sg-ZZZZZZ"
},
{
"GroupName": "somegroup2",
"GroupId": "sg-YYYYYY"
}
],
"Ipv6Addresses": [],
"SubnetId": "subnet-00001234",
"OwnerId": "123456789012",
"PrivateIpAddress": "172.31.1.2"
}],
"SourceDestCheck": true,
"Placement": {
"Tenancy": "default",
"GroupName": "",
"AvailabilityZone": "ap-southeast-1b"
},
"Hypervisor": "xen",
"BlockDeviceMappings": [{
"DeviceName": "/dev/xvda",
"Ebs": {
"Status": "attached",
"DeleteOnTermination": true,
"VolumeId": "vol-33221100",
"AttachTime": "2016-01-13T08:33:39.000Z"
}
}],
"Architecture": "x86_64",
"StateReason": {
"Message": "Client.UserInitiatedShutdown: User initiated shutdown",
"Code": "Client.UserInitiatedShutdown"
},
"RootDeviceName": "/dev/xvda",
"VirtualizationType": "hvm",
"Tags": [{
"Value": "SomeValue",
"Key": "SomeKey"
},
{
"Value": "AnotherValue",
"Key": "Name"
}
],
"AmiLaunchIndex": 0
}]
}]
}
I want to copy the values of the Keys in the original JSON file to the template file.
For example, KeyName is a common key between the 2 JSON files. The corresponding value tempKey is replaced in the template file.
The main use case of this is: I am trying to migrate a number of servers on AWS from 1 region to another. This is a part of migration process which will remove tons of manual clicking and configuration on AWS Console.
Note: I use BASH command line.
There's a way to do this with jq but it doesn't take a JSON template as input.
You'll have to modify it to become a query. This isn't the actual query you need, but something to get you started:
cat temp.json | jq '.Reservations[].Instances[] | { DryRun, ImageId, KeyName, SecurityGroups, InstanceType, Monitoring }'
Where temp.json is your output above that I placed into a file. For regular commands, just do something like aws ec2 describe-instances | jq ...
The output that gives me (keep in mind the restricted set I queried for) is:
{
"DryRun": null,
"ImageId": "ami-1234abcd",
"KeyName": "tempKey",
"SecurityGroups": [
{
"GroupName": "somegroup1",
"GroupId": "sg-ZZZZZ"
},
{
"GroupName": "somegroup2",
"GroupId": "sg-YYYYY"
}
],
"InstanceType": "t2.medium",
"Monitoring": {
"State": "disabled"
}
}
Hope this helps.

How to get json data from multiple object levels [duplicate]

This question already has answers here:
How can I access and process nested objects, arrays, or JSON?
(31 answers)
Closed 6 years ago.
I need to create a table from selected data generated by some rental software in json format via an api. The json data supplied is a list of products, and is quite extensive with objects containing other objects and arrays.
The problem comes when I need to retrieve the data from an object within an object. I want to get Name, weight and Rental Price form the data below. The rental price is in the rental_rate object.
{
"products": [
{
"id": 1404,
"name": "Product 1",
"type": "Product",
"tag_list": [],
"description": "",
"allowed_stock_type": 1,
"allowed_stock_type_name": "Rental",
"stock_method": 1,
"stock_method_name": "Bulk",
"buffer_percent": "50.0",
"post_rent_unavailability": 0,
"replacement_charge": "0.0",
"weight": "0.5",
"barcode": "#st2078",
"active": true,
"accessory_only": false,
"system": false,
"discountable": true,
"rental_rate": {
"item_id": 1404,
"store_id": 1,
"transaction_type": 1,
"rate_definition_id": 3,
"price": "10.0",
"deposit": "0.0",
"category_prices": [],
"properties": {
"day_cost": "0.0",
"day_price": "0.0",
"hour_cost": "0.0",
"hour_price": "0.0",
"__value_types": "---\nday_price: BigDecimal\nhour_price: BigDecimal\ndistance_price: BigDecimal\nflat_rate_price: BigDecimal\nday_cost: BigDecimal\nhour_cost: BigDecimal\ndistance_cost: BigDecimal\nflat_rate_cost: BigDecimal\n",
"distance_cost": "0.0",
"distance_price": "0.0",
"flat_rate_cost": "0.0",
"flat_rate_price": "0.0"
},
"priority": 0,
"date_range": "1900-01-01...3000-01-01"
},
"sale_rate": null,
"product_group_id": 5,
"tax_class_id": 2,
"rental_revenue_group_id": 1,
"sale_revenue_group_id": null,
"created_at": "2017-02-06T00:49:47.755Z",
"updated_at": "2017-02-06T00:49:47.755Z",
"custom_fields": {
"barcode_notes": "Actual Leg Length is: 3'",
"product_serial_number": ""
},
"product_group": {
"id": 5,
"name": "Staging",
"description": "",
"created_at": "2017-02-05T22:20:53.465Z",
"updated_at": "2017-02-05T22:20:53.465Z",
"custom_fields": {}
},
"tax_class": {
"id": 2,
"name": "VAT Standard"
},
"icon": null,
"rental_revenue_group": {
"id": 1,
"name": "Rental",
"description": "",
"active": true
},
"sale_revenue_group": null,
"accessories": [],
"alternative_products": [],
"attachments": [],
"rental_rates": [
{
"id": 1782,
"store_id": null,
"store_name": "",
"rate_definition_id": 3,
"rate_definition_name": "3 Day Week Rate",
"starts_at": null,
"ends_at": null,
"price": "10.0",
"category_prices": []
}
],
"sale_rates": []
},
{
"id": 2395,
"name": "Product 2",
"type": "Product",
"tag_list": [],
"description": "",
"allowed_stock_type": 1,
"allowed_stock_type_name": "Rental",
"stock_method": 2,x
"stock_method_name": "Serialised",
"buffer_percent": "50.0",
"post_rent_unavailability": 0,
"replacement_charge": "0.0",
"weight": "45.0",
"barcode": "",
"active": true,
"accessory_only": false,
"system": false,
"discountable": true,
"rental_rate": {
"item_id": 2395,
"store_id": 1,
"transaction_type": 1,
"rate_definition_id": 3,
"price": "0.0",
"deposit": "0.0",
"category_prices": [],
"properties": {
"day_cost": "0.0",
"day_price": "0.0",
"hour_cost": "0.0",
"hour_price": "0.0",
"__value_types": "---\nday_price: BigDecimal\nhour_price: BigDecimal\ndistance_price: BigDecimal\nflat_rate_price: BigDecimal\nday_cost: BigDecimal\nhour_cost: BigDecimal\ndistance_cost: BigDecimal\nflat_rate_cost: BigDecimal\n",
"distance_cost": "0.0",
"distance_price": "0.0",
"flat_rate_cost": "0.0",
"flat_rate_price": "0.0"
},
"priority": 0,
"date_range": "1900-01-01...3000-01-01"
},
"sale_rate": null,
"product_group_id": 6,
"tax_class_id": 2,
"rental_revenue_group_id": 1,
"sale_revenue_group_id": null,
"created_at": "2017-02-06T00:50:35.834Z",
"updated_at": "2017-02-06T00:50:35.834Z",
"custom_fields": {
"barcode_notes": "",
"product_serial_number": ""
},
"product_group": {
"id": 6,
"name": "Cases",
"description": "",
"created_at": "2017-02-05T22:20:53.509Z",
"updated_at": "2017-02-05T22:20:53.509Z",
"custom_fields": {}
},
"tax_class": {
"id": 2,
"name": "VAT Standard"
},
"icon": null,
"rental_revenue_group": {
"id": 1,
"name": "Rental",
"description": "",
"active": true
},
"sale_revenue_group": null,
"accessories": [],
"alternative_products": [],
"attachments": [],
"rental_rates": [
{
"id": 2773,
"store_id": null,
"store_name": "",
"rate_definition_id": 3,
"rate_definition_name": "3 Day Week Rate",
"starts_at": null,
"ends_at": null,
"price": "0.0",
"category_prices": []
}
],
"sale_rates": []
}
],
"meta": {
"total_row_count": 1376,
"row_count": 2,
"page": 1,
"per_page": 2
}
}
and here is the JS I am using to get the data:
$(document).ready( function() {
$.getJSON( 'https://myapi.com/products', function(data) {
$.each(data.products, function() {
$("table#prod").append("<tr><td>" + this['name'] + "</td><td>" + this['rental_rate.price'] + "</td><td>" + this['weight'] + "kg</td></tr>");
}); }); });
This works fine for name and weight, but not rental price. I have done a thorough search of most places on the internet and not found an answer - my javascript knowledge is limited, which probably means I am going about this all wrong, or not describing it well enough...
Any help or improved methods would be much appreciated!
this.name gets you the name
this.rental_rate gets you the nested rental rate object.
this.rental_rate.price gets you the price.
You can similarly use square bracket notation, but people often only do this when dot syntax won't work (because of spaces in the key).
e.g.
this["name"]
this["rental_rate"]["price"]
this["Invalid Key when accessed via dot syntax but fine with square brackets"]

Display data from common topic in Freebase using jQuery

I am playing around with Freebase and have had some decent success, but have hit a wall. My MQL is below. I do not have any issue displaying name,latin name, etc, which I created in my base. I do not know how to display the article which is in a different base.
Here is the jQuery I am using to display data:
$('<div>',{text:this.name}).appendTo(document.body);
Thank you very much,
Todd
query : [
{
"/common/topic/article": {
"guid": null,
"limit": 1,
"optional": true
},
"/common/topic/image": {
"id": null,
"limit": 1,
"optional": true
},
"id": null,
"larval_food": [
{
"index": null,
"lang": "/lang/en",
"limit": 6,
"optional": true,
"sort": "index",
"type": "/type/text",
"value": null
}
],
"latin_name": [
{
"index": null,
"lang": "/lang/en",
"limit": 6,
"optional": true,
"sort": "index",
"type": "/type/text",
"value": null
}
],
"limit": 60,
"name": null,
"s0:type": [
{
"id": "/base/butterflies/butterfly",
"link": [
{
"timestamp": [
{
"optional": true,
"type": "/type/datetime",
"value": null
}
],
"type": "/type/link"
}
],
"type": "/type/type"
}
],
"sort": "-s0:type.link.timestamp.value",
"type": "/base/butterflies/butterfly"
}
]
Change
"type": "/base/butterflies/butterfly"
to the type of the thing you actually want to include.
As an aside, that looks like a query which was exported from one of the Freebase.com view pages. It can be greatly simplified and some of the stuff, like the sorting, you probably want removed altogether.
Here's your query simplied (I also recommend using the standard scientific name property instead of inventing your own "Latin name" property):
[{
"type": "/base/butterflies/butterfly",
"mid": null,
"name": null,
"/common/topic/article": [],
"/common/topic/image": ["mid":null,"optional":true],
"larval_food": [],
"latin_name": [],
"/biology/organism_classification/scientific_name" : [],
}]
Here's a version of the query which shows all organism classifications (species in this case) which have the tribe Danaini two levels up. It optionally decorates it with data (larval_food) from your base, if it exists:
[{
"type": "/biology/organism_classification",
"higher_classification": [{
"/biology/organism_classification/higher_classification": "Danaini"
}],
"mid": null,
"name": null,
"scientific_name": [],
"/common/topic/article": [],
"/common/topic/image": [{
"mid": null,
"optional": true
}],
"/base/butterflies/butterfly/larval_food": [],
}]
You can try it here: http://tinyurl.com/6wht7lx

Categories

Resources