Problem getting Image URL with Strapi / Nuxt - json

I am trying to get the image URL from a JSON which I get from a call to my strapi content. It is for an events website. Here is the code. When I console.log the image url, i get 'undefined'. However, all other properties of event show up no problem.
created() {
axios.get('http://localhost:1338/events').then(res => {
this.events = res.data.sort((a, b) => b.date < a.date ? 1: -1);
console.log(this.events[0].image.url)
})
.catch(err => console.log(err))
}
Console: undefined
Here is the JSON:
{
"id": 1,
"title": "Aphex Twin Live Set",
"description": "Risus viverra adipiscing at in tellus integer feugiat scelerisque varius.",
"date": "2020-12-23T16:00:00.000Z",
"price": 10,
"published_at": "2020-12-19T17:25:44.340Z",
"created_at": "2020-12-19T17:25:41.833Z",
"updated_at": "2020-12-19T21:42:15.696Z",
"image": [
{
"id": 1,
"name": "aphex.jpeg",
"alternativeText": "",
"caption": "",
"width": 1200,
"height": 630,
"formats": {
"thumbnail": {
"name": "thumbnail_aphex.jpeg",
"hash": "thumbnail_aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 245,
"height": 129,
"size": 4.12,
"path": null,
"url": "/uploads/thumbnail_aphex_11b34d4058.jpeg"
},
"large": {
"name": "large_aphex.jpeg",
"hash": "large_aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 1000,
"height": 525,
"size": 28.49,
"path": null,
"url": "/uploads/large_aphex_11b34d4058.jpeg"
},
"medium": {
"name": "medium_aphex.jpeg",
"hash": "medium_aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 750,
"height": 394,
"size": 18.95,
"path": null,
"url": "/uploads/medium_aphex_11b34d4058.jpeg"
},
"small": {
"name": "small_aphex.jpeg",
"hash": "small_aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 500,
"height": 263,
"size": 10.67,
"path": null,
"url": "/uploads/small_aphex_11b34d4058.jpeg"
}
},
"hash": "aphex_11b34d4058",
"ext": ".jpeg",
"mime": "image/jpeg",
"size": 37.07,
"url": "/uploads/aphex_11b34d4058.jpeg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"created_at": "2020-12-19T17:25:35.172Z",
"updated_at": "2020-12-19T17:25:35.183Z"
}
],
"categories": [
{
"id": 1,
"name": "Music",
"published_at": "2020-12-19T21:18:16.946Z",
"created_at": "2020-12-19T21:18:13.393Z",
"updated_at": "2020-12-19T21:18:16.961Z"
}
],
"artists": [
{
"id": 1,
"name": "Aphex Twin",
"bio": "Richard James is a pretty old guy by now but he was banging in the techno/ambient electronic scene in the late 80s and 90s. He's from Cornwall so must've been pretty bored on most days, which lead him to hack at computers and electronic sound generators. The rest is history.",
"published_at": "2020-12-19T21:42:33.225Z",
"created_at": "2020-12-19T21:42:03.445Z",
"updated_at": "2020-12-19T21:42:33.251Z",
"artist_image": []
}
]
}
Again -- all fields show if I console.log, but not image.url

Got it -- the image field is an array because I allowed multiple media on Strapi. Had to do event.image[0].url

Related

Flutter dynamic data from api to make Widgets

In my case the json will be different every time and i have to make widget like "inputtype": "dropdown", "inputtype": "radiobutton" but if i craete model it don't go as i wants it to.
{
"fields": [
{
"id": 31,
"name": "make",
"isrequired": "required",
"valuetype": "text",
"priority": 1,
"inputtype": "dropdown",
"max_min": [],
"rangeable": "false",
"choices": [
{
"id": 46,
"name": "Samsung",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:30:47.000000Z",
"updated_at": "2021-12-29T01:30:47.000000Z",
"priority": 10
},
{
"id": 47,
"name": "Dell",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:30:52.000000Z",
"updated_at": "2021-12-29T01:30:52.000000Z",
"priority": 20
},
{
"id": 48,
"name": "IBM",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:31:09.000000Z",
"updated_at": "2021-12-29T01:31:09.000000Z",
"priority": 30
},
{
"id": 49,
"name": "Acer",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:31:24.000000Z",
"updated_at": "2021-12-29T01:31:24.000000Z",
"priority": 40
}
],
"available": []
},
{
"id": 32,
"name": "model",
"isrequired": "required",
"valuetype": "text",
"priority": 2,
"inputtype": "textfield",
"max_min": [],
"rangeable": "false",
"choices": [],
"available": [
{
"model": "a51"
},
{
"model": "y9s"
},
{
"model": "a31"
},
{
"model": "yS10"
},
{
"model": "Y10S"
},
{
"model": "A551"
},
{
"model": "node8"
},
{
"model": "s9"
},
{
"model": null
},
{
"model": "2021"
},
{
"model": "2020"
},
{
"model": "2010"
},
{
"model": "Civic"
},
{
"model": "2019"
},
{
"model": "Daewooy9"
},
{
"model": "corei5"
},
{
"model": "corei9"
},
{
"model": "corei3"
},
{
"model": "corei11"
}
]
},
{
"id": 29,
"name": "features",
"isrequired": "required",
"valuetype": "text",
"priority": 3,
"inputtype": "checkbox",
"max_min": [],
"rangeable": "false",
"choices": [
{
"id": 41,
"name": "Bluetooth",
"categoryextrafield_id": 29,
"created_at": "2021-12-29T01:19:00.000000Z",
"updated_at": "2021-12-29T01:19:00.000000Z",
"priority": 1
},
{
"id": 42,
"name": "Fingerprint",
"categoryextrafield_id": 29,
"created_at": "2021-12-29T01:19:10.000000Z",
"updated_at": "2021-12-29T01:19:10.000000Z",
"priority": 10
},
{
"id": 43,
"name": "LedDisplay",
"categoryextrafield_id": 29,
"created_at": "2021-12-29T01:19:35.000000Z",
"updated_at": "2021-12-29T01:19:35.000000Z",
"priority": 15
}
],
"available": []
},
{
"id": 30,
"name": "condition",
"isrequired": "required",
"valuetype": "text",
"priority": 4,
"inputtype": "radiobutton",
"max_min": [],
"rangeable": "false",
"choices": [
{
"id": 44,
"name": "Used",
"categoryextrafield_id": 30,
"created_at": "2021-12-29T01:20:31.000000Z",
"updated_at": "2021-12-29T01:20:31.000000Z",
"priority": 10
},
{
"id": 45,
"name": "New",
"categoryextrafield_id": 30,
"created_at": "2021-12-29T01:20:38.000000Z",
"updated_at": "2021-12-29T01:20:38.000000Z",
"priority": 20
}
],
"available": []
}
]
}

Chainlink multi-variable responses - results not getting appended

I'm trying to implement a multi-variable job on my local node, however I'm finding that only 1 of the 3 results are being added to the chainlink_result_collection array in the resultcollect task. My definition is very similar to the example one linked, the main difference being the use of an external adapter
Running the above example smart contract and spec on my node works, and gives the following output. Take note of the chainlink_result_collection array being appended to after each run. Have linked the output file to stay under the 30k size limit for SO posts
However when I try to run my multi-variable job, I get the following output. Take note of the chainlink_result_collection after each resultcollect task. You can see each time it's being set to the latest return value, instead of being appended to like the previous job output. So the length of the chainlink_result_collection array at the end is 1 instead of 3 elements
{
"id": "c27b2627-3aeb-4acb-8b84-1e191854b25d",
"jobId": "332118053343434c8d519e4c3a8c3fef",
"result": {
"data": {
"result": "0x0000000000000000000000000000000000000000000000020000000000002060",
"address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
"dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
"unixDateTime": "1625097600",
"functionSelector": "0x4ab0d190",
"aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
"__chainlink_result_collection__": [
"0x0000000000000000000000000000000000000000000000020000000000002060"
]
},
"error": "insertEthTx failed while constructing EthTx data: number of collectors 2 != number of types in ABI encoding 4"
},
"status": "errored",
"taskRuns": [
{
"id": "5b7a842a-c5bb-47bb-86d6-9ffc9a8d6288",
"result": {
"data": {
"address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
"dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
"roundAnswer": "36893488147419111519",
"unixDateTime": "1625097600",
"functionSelector": "0x4ab0d190",
"laterRoundAnswer": "36893488147419111520",
"aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
"earlierRoundAnswer": "36893488147419111518"
},
"error": null
},
"status": "completed",
"task": {
"ID": 83,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "historical-price",
"confirmations": null,
"params": {
},
"CreatedAt": "2021-08-27T16:16:00.169781+09:30",
"UpdatedAt": "2021-08-27T16:16:00.169781+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 3
},
{
"id": "ce1394bd-5d9e-4150-8fd2-7d251b69a81d",
"result": {
"data": {
"result": "36893488147419111519"
},
"error": null
},
"status": "completed",
"task": {
"ID": 84,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "copy",
"confirmations": null,
"params": {
"copyPath": [
"roundAnswer"
]
},
"CreatedAt": "2021-08-27T16:16:00.170343+09:30",
"UpdatedAt": "2021-08-27T16:16:00.170343+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "da32538d-b640-4bcb-8acb-fe9aafa344b0",
"result": {
"data": {
"result": "0x000000000000000000000000000000000000000000000002000000000000205f"
},
"error": null
},
"status": "completed",
"task": {
"ID": 85,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "ethuint256",
"confirmations": null,
"params": {
},
"CreatedAt": "2021-08-27T16:16:00.170885+09:30",
"UpdatedAt": "2021-08-27T16:16:00.170885+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "372cdf12-8752-492c-9c2d-ff3354d878af",
"result": {
"data": {
"result": "0x000000000000000000000000000000000000000000000002000000000000205f",
"address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
"dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
"unixDateTime": "1625097600",
"functionSelector": "0x4ab0d190",
"aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
"__chainlink_result_collection__": [
"0x000000000000000000000000000000000000000000000002000000000000205f"
]
},
"error": null
},
"status": "completed",
"task": {
"ID": 86,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "resultcollect",
"confirmations": null,
"params": {
},
"CreatedAt": "2021-08-27T16:16:00.171458+09:30",
"UpdatedAt": "2021-08-27T16:16:00.171458+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "0c8e18c2-c352-4af0-a282-a19fbcf03c2d",
"result": {
"data": {
"address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
"dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
"roundAnswer": "36893488147419111519",
"unixDateTime": "1625097600",
"functionSelector": "0x4ab0d190",
"laterRoundAnswer": "36893488147419111520",
"aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
"earlierRoundAnswer": "36893488147419111518"
},
"error": null
},
"status": "completed",
"task": {
"ID": 87,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "historical-price",
"confirmations": null,
"params": {
},
"CreatedAt": "2021-08-27T16:16:00.172138+09:30",
"UpdatedAt": "2021-08-27T16:16:00.172138+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "48482e08-bed1-4956-8aa8-3ff6f2d9f38d",
"result": {
"data": {
"result": "36893488147419111518"
},
"error": null
},
"status": "completed",
"task": {
"ID": 88,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "copy",
"confirmations": null,
"params": {
"copyPath": [
"earlierRoundAnswer"
]
},
"CreatedAt": "2021-08-27T16:16:00.172638+09:30",
"UpdatedAt": "2021-08-27T16:16:00.172638+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "825ed16c-b662-4fb2-ac2d-abeee3259cfc",
"result": {
"data": {
"result": "0x000000000000000000000000000000000000000000000002000000000000205e"
},
"error": null
},
"status": "completed",
"task": {
"ID": 89,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "ethuint256",
"confirmations": null,
"params": {
},
"CreatedAt": "2021-08-27T16:16:00.173151+09:30",
"UpdatedAt": "2021-08-27T16:16:00.173151+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "58ade305-bc91-4542-83b5-8b4e0018eebf",
"result": {
"data": {
"result": "0x000000000000000000000000000000000000000000000002000000000000205e",
"address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
"dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
"unixDateTime": "1625097600",
"functionSelector": "0x4ab0d190",
"aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
"__chainlink_result_collection__": [
"0x000000000000000000000000000000000000000000000002000000000000205e"
]
},
"error": null
},
"status": "completed",
"task": {
"ID": 90,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "resultcollect",
"confirmations": null,
"params": {
},
"CreatedAt": "2021-08-27T16:16:00.173677+09:30",
"UpdatedAt": "2021-08-27T16:16:00.173677+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "d7982f84-03be-4f41-a6ad-ee487c84fc6b",
"result": {
"data": {
"address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
"dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
"roundAnswer": "36893488147419111519",
"unixDateTime": "1625097600",
"functionSelector": "0x4ab0d190",
"laterRoundAnswer": "36893488147419111520",
"aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
"earlierRoundAnswer": "36893488147419111518"
},
"error": null
},
"status": "completed",
"task": {
"ID": 91,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "historical-price",
"confirmations": null,
"params": {
},
"CreatedAt": "2021-08-27T16:16:00.174159+09:30",
"UpdatedAt": "2021-08-27T16:16:00.174159+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "cf3a1caa-723e-4b2f-ae50-6096007dd02e",
"result": {
"data": {
"result": "36893488147419111520"
},
"error": null
},
"status": "completed",
"task": {
"ID": 92,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "copy",
"confirmations": null,
"params": {
"copyPath": [
"laterRoundAnswer"
]
},
"CreatedAt": "2021-08-27T16:16:00.174617+09:30",
"UpdatedAt": "2021-08-27T16:16:00.174617+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "53d76d5c-01b2-4e0d-8515-9f1a4901635b",
"result": {
"data": {
"result": "0x0000000000000000000000000000000000000000000000020000000000002060"
},
"error": null
},
"status": "completed",
"task": {
"ID": 93,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "ethuint256",
"confirmations": null,
"params": {
},
"CreatedAt": "2021-08-27T16:16:00.175071+09:30",
"UpdatedAt": "2021-08-27T16:16:00.175071+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "1fb908bb-9539-4617-9395-4e5796e214c2",
"result": {
"data": {
"result": "0x0000000000000000000000000000000000000000000000020000000000002060",
"address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
"dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
"unixDateTime": "1625097600",
"functionSelector": "0x4ab0d190",
"aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
"__chainlink_result_collection__": [
"0x0000000000000000000000000000000000000000000000020000000000002060"
]
},
"error": null
},
"status": "completed",
"task": {
"ID": 94,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "resultcollect",
"confirmations": null,
"params": {
},
"CreatedAt": "2021-08-27T16:16:00.175515+09:30",
"UpdatedAt": "2021-08-27T16:16:00.175515+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
},
{
"id": "8763850e-80a6-4a1b-af04-aabfb69ff2c9",
"result": {
"data": {
},
"error": "insertEthTx failed while constructing EthTx data: number of collectors 2 != number of types in ABI encoding 4"
},
"status": "errored",
"task": {
"ID": 95,
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "ethtx",
"confirmations": 1,
"params": {
"abiEncoding": [
"bytes32",
"uint80",
"uint80",
"uint80"
]
},
"CreatedAt": "2021-08-27T16:16:00.175982+09:30",
"UpdatedAt": "2021-08-27T16:16:00.175982+09:30",
"DeletedAt": null
},
"minimumConfirmations": 3,
"confirmations": 1
}
],
"createdAt": "2021-08-27T16:16:52.308136+09:30",
"finishedAt": "2021-08-27T16:18:59.22246+09:30",
"updatedAt": "2021-08-27T16:18:59.259186+09:30",
"creationHeight": "26956178",
"observedHeight": "26956180",
"payment": "0",
"initiator": {
"id": 7,
"jobSpecId": "33211805-3343-434c-8d51-9e4c3a8c3fef",
"type": "runlog",
"params": {
"address": "0xb6efece462ea6118a0a7ec1f2a3c7033b1f82967"
}
},
"type": "Direct request job run"
}
This is my job definition:
{
"name": "multi-word2",
"initiators": [
{
"id": 7,
"jobSpecId": "33211805-3343-434c-8d51-9e4c3a8c3fef",
"type": "runlog",
"params": {
"address": "0xb6efece462ea6118a0a7ec1f2a3c7033b1f82967"
}
}
],
"tasks": [
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "historical-price"
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "copy",
"params": {
"copyPath": [
"roundAnswer"
]
}
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "ethuint256"
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "resultcollect"
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "historical-price"
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "copy",
"params": {
"copyPath": [
"earlierRoundAnswer"
]
}
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "ethuint256"
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "resultcollect"
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "historical-price"
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "copy",
"params": {
"copyPath": [
"laterRoundAnswer"
]
}
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "ethuint256"
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "resultcollect"
},
{
"jobSpecId": "332118053343434c8d519e4c3a8c3fef",
"type": "ethtx",
"confirmations": 1,
"params": {
"abiEncoding": [
"bytes32",
"uint80",
"uint80",
"uint80"
]
}
}
]
}
the issue is that the 'chainlink_result_collection' array is not passed through from the resultsCollect to the EA (external adapter) call, whereas it is from resultsCollect to a normal HTTP Get task. I verified this by creating a job that contains 3 requests (EA, HTTPGET, EA), and observed that at the resultsCollect for the HTTPGet, the array correctly had 2 values, however on the final request (EA), the array didn't get passed through to the EA task, and the end result was just the 1 return value from the final EA
There's an open issue on this at the Chainlink GitHub

Error parsing a specific JSON file in Snowflake with File Format

I have created a Stage and File Format in Snowflake which works with all my other JSON files except this, which throws an error:
Error parsing JSON: misplaced { File 'rooms.json.gz', line 1,
character 2 Row 0, column $1
I am using the same query that I am using for other files.
SELECT $1
FROM #MySchema.MY_STAGE/rooms.json.gz
;
What is wrong with the structure of this specific JSON file?
{
"rooms": [
{
"area": 131.49,
"longDescription": "",
"dateCreated": 1589908063390,
"reservable": false,
"name": "E249",
"remoteInfo": "",
"description": "",
"id": 2,
"type": {
"hexColor": "c16058",
"contentFlag": 1,
"cost": 0.0,
"dateCreated": 1308610520717,
"color": {},
"name": "BREAK ROOM",
"occupiable": false,
"id": 120,
"parkingSpace": false,
"dateUpdated": 1591818585913,
"typeCode": ""
},
"floor": {
"area": 25312.9878,
"dateCreated": 1589907703870,
"drawingAvailable": true,
"interiorGross": 0.0,
"name": "2",
"leaseArea": 0.0,
"id": 12,
"building": {
"address": {
"country": {
"defaultSelected": true,
"subdivisionCategoryName": "state",
"alpha2Code": "US",
"isoCode": "US",
"name": "United States of America (the)",
"id": 223
},
"city": "Some City",
"street": "Some Drive",
"postalCode": "00000",
"state": {
"country": {
"defaultSelected": true,
"subdivisionCategoryName": "state",
"alpha2Code": "US",
"isoCode": "US",
"name": "United States of America (the)",
"id": 223
},
"defaultSelected": false,
"code": "XX",
"name": "Some State",
"id": 66,
"categoryName": "state"
}
},
"code": "B2",
"dateCreated": 1589907508020,
"metric": false,
"name": "Some name",
"location": {},
"revitLink": "",
"id": 45,
"dateUpdated": 1601315841453,
"costCenters": []
},
"dateUpdated": 1600441936663
},
"capacity": 0,
"dateUpdated": 1600441936960
}
]
}
Edit: Screenshot from Notepad++ with all characters enabled

Ionic Json nested

I'm new in Ionic development. I'm having a problem retrieving JSON.
"Failed to load https://api.wh.geniussports.com/v1/basketball/competitions/19816/matcheslive?ak=eebd8ae256142ac3fd24bd2003d28782: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access."
Here's my json format
{
"response": {
"meta": {
"version": 1,
"code": 200,
"status": "success",
"request": "http://api.wh.geniussports.com/v1/basketball/competitions/19816/matcheslive?ak=eebd8ae256142ac3fd24bd2003d28782",
"time": 1528177532,
"count": 10,
"limit": 10
},
"data": [
{
"leagueId": 6,
"matchId": 784470,
"competitionId": 19816,
"venueId": 17386,
"poolNumber": 0,
"roundNumber": "1",
"roundDescription": "",
"matchNumber": 1,
"matchStatus": "COMPLETE",
"matchName": "",
"phaseName": "",
"extraPeriodsUsed": 0,
"matchTime": "2017-11-17 19:30:00",
"matchTimeUTC": "2017-11-17 11:30:00",
"enddate": null,
"timeActual": "2017-11-17 19:45:37",
"timeEndActual": "2017-11-17 21:12:10",
"durationActual": 87,
"temperature": 0,
"attendance": 0,
"duration": 120,
"weather": "",
"twitterHashtag": "",
"liveStream": 1,
"matchType": "REGULAR",
"keywords": "",
"ticketURL": "",
"externalId": "920",
"nextMatchId": 0,
"placeIfWon": 0,
"placeIfLost": 0,
"updated": "2017-11-24 11:04:00",
"linkDetail": "/v1/basketball/matches/784470",
"linkDetailLeague": "/v1/basketball/leagues/6",
"venue": {
"venueId": 17386,
"venueName": "Nanhai Gymnasium",
"venueNameInternational": "",
"venueNickname": "Nanhai Gym",
"venueNicknameInternational": "",
"surfaceName": "",
"locationName": "",
"website": "",
"ticketURL": "",
"externalId": "54",
"linkDetailVenue": "/v1/basketball/venues/17386"
},
"leagueName": "ASEAN Basketball League",
"leagueNameInternational": "",
"competitionName": "2017 ASEAN Basketball League",
"competitionNameInternational": "",
"gsId": "",
"competitors": [
{
"competitorType": "TEAM",
"competitorName": "Singapore Slingers",
"competitorId": 88261,
"linkDetailCompetitor": "/v1/basketball/teams/88261",
"scoreString": "59",
"scoreSecondaryString": "",
"completionStatus": "COMPLETE",
"resultPlacing": 0,
"isDrawn": 0,
"isHomeCompetitor": 0,
"teamId": 88261,
"teamName": "Singapore Slingers",
"teamGsId": null,
"teamNameInternational": "",
"teamNickname": "Singapore Slingers",
"teamNicknameInternational": "",
"teamCode": "",
"teamCodeInternational": "",
"website": "",
"internationalReference": "",
"externalId": "74",
"images": {
"logo": {
"L1": {
"size": "L1",
"height": 600,
"width": 600,
"bytes": 45196,
"url": "http://img.wh.sportingpulseinternational.com/5b71cf0a1af51c8376eda43e6ba5bc22L1.jpg"
},
"M1": {
"size": "M1",
"height": 400,
"width": 400,
"bytes": 25005,
"url": "http://img.wh.sportingpulseinternational.com/5b71cf0a1af51c8376eda43e6ba5bc22M1.jpg"
},
"S1": {
"size": "S1",
"height": 200,
"width": 200,
"bytes": 9180,
"url": "http://img.wh.sportingpulseinternational.com/5b71cf0a1af51c8376eda43e6ba5bc22S1.jpg"
},
"T1": {
"size": "T1",
"height": 75,
"width": 75,
"bytes": 2270,
"url": "http://img.wh.sportingpulseinternational.com/5b71cf0a1af51c8376eda43e6ba5bc22T1.jpg"
}
}
},
"clubId": 62,
"clubGsId": null,
"clubName": "Singapore Slingers",
"clubNameInternational": "",
"linkDetailClub": "/v1/basketball/clubs/62"
},
Below is my loadUser function
loadUser(){
this.http.get('http://api.wh.geniussports.com/v1/basketball/competitions/19816/matcheslive?ak=eebd8ae256142ac3fd24bd2003d28782')
.map(res => res.json())
.subscribe(res => {
this.data = data.results;
console.log(data.results);
}, err => {
console.log(err);
});
}
My main goal is to log the data[] array. Please help me
This is the problem with browser, typically its a security concern not to allow other requests which may lead to XSS attack easily. If only for development I suggest you to install a plugin which will disable in your browser plugin
If for production, then you need to configure your API then do this .

How do I render json in my react component?

I have the following json file I am importing into my component:
import { beer, wine, spririts, alcopop } from '../../config/calculator.json';
How can I use the json in my render?
Depending upon what was chosen I would like to use the data for each element, if user clicks beer, then show data for beer. For example, how would I loop through 'sizes' in 'beer'? This is my code so far:
{[drinkType].sizes.map((option, i) =>
<div value={option.id} key={i}>
{option}
</div>
)}
I would like to display the size name, pint, bottle, can etc
I get the error: Cannot read property 'map' of undefined
//calculator.json
{
"beer": {
"name": "Beer or cider",
"sizes": {
"568": {
"name": "Pint",
"size": 0.568,
"id": "pint",
"max": 10,
"icon": "beer_pint"
},
"440": {
"name": "Can",
"size": 0.44,
"id": "can",
"max": 10,
"icon": "beer_can"
},
"330": {
"name": "Bottle",
"size": "0.33",
"id": "bottle",
"max": "10",
"icon": "beer_bottle_330"
},
"275": {
"name": "Small bottle",
"size": 0.275,
"id": "smallBottle",
"max": 10,
"icon": "beer_bottle_275"
}
},
"strength": [4, 4.5, 5, 6, 7, 8, 9]
},
"wine": {
"name": "Wine or champagne",
"sizes": {
"125": {
"name": "Small glass",
"size": 0.125,
"id": "small",
"max": 10,
"icon": "wine_small_glass"
},
"175": {
"name": "Standard glass",
"size": 0.175,
"id": "std",
"max": 10,
"icon": "wine_standard_glass"
},
"250": {
"name": "Large glass",
"size": 0.25,
"id": "large",
"max": 10,
"icon": "wine_large_glass"
},
"1000": {
"name": "Bottle",
"size": 1,
"id": "bottle",
"max": 10,
"icon": "wine_bottle"
}
},
"strength": [9, 10, 10.5, 11, 11.5, 12, 13, 14, 15, 16, 17]
},
"spirits": {
"name": "Spirits or shots",
"sizes": {
"25": {
"name": "Single",
"size": 0.025,
"id": "single",
"max": 10,
"icon": "spirit_single"
},
"35": {
"name": "Large single",
"size": 0.035,
"id": "lgSingle",
"max": 10,
"icon": "spirit_large_single"
},
"50": {
"name": "Double",
"size": 0.05,
"id": "double",
"max": 10,
"icon": "spirit_double"
},
"70": {
"name": "Large double",
"size": 0.07,
"id": "lgDouble",
"max": 10,
"icon": "spirit_large_double"
},
"700": {
"name": "Bottle",
"size": 0.7,
"id": "bottle700",
"max": 3,
"icon": "spirit_bottles"
},
"1000": {
"name": "Bottle",
"size": 1,
"id": "bottle",
"max": 3,
"icon": "spirit_bottles"
}
},
"strength": [37, 40]
},
"alcopop": {
"name": "Alcopop",
"sizes": {
"275": {
"name": "Small bottle",
"size": 0.275,
"id": "small",
"max": 10,
"icon": "alcopops_small_bottle"
},
"330": {
"name": "Standard bottle",
"size": 0.33,
"id": "std",
"max": 10,
"icon": "alcopops_standard_bottle"
},
"750": {
"name": "Large bottle",
"size": 0.75,
"id": "large",
"max": 10,
"icon": "alcopops_large_bottle"
}
},
"strength": [5, 5.5]
}
}
.map does not work on objects like that,
map() is only for Arrays
Instead you can store the keys in array and use them, like,
import jsonData from '../../config/calculator';
...
//in constructor or any function
let sizes;
sizes={};
for(let i of Object.keys(jsonData)){
if(!sizes[i][0])sizes[i] = [];
for(let j of Object.keys(i.sizes)){
sizes[i].push(jsonData[i].sizes[j])
}
}
this.setState({
sizesArray:sizes
})
Now you can use this.state.sizesArray.map to iterate over sizes, like,
{this.state.sizes[drinkType].map((option, i) =>
<div value={option.id} key={i}>
{option}
</div>
)}
First, import your json inside the component:
import jsonData from '../../config/calculator'; //specify the appropriate location of the json file
Then you can access the "data" in your component in various ways. One way could be:
constructor() {
this.state = {
data: []
}
}
componentDidMount(){
this.setState({data: jsonData});
}
And accordingly, you can use this data(this.state.data).