Accessing item in array of json object - arrays

The following is my json response from one of my APIs. I am trying to print image URL on console. You will see response is list of requests with each request having an array of images (json objects)
[
{
"image": [
{
"_id": "5fbfdc75aea26e00484a787a",
"name": "WhatsApp Image 2020-10-23 at 11.55.25 AM.jpeg",
"alternativeText": "",
"caption": "",
"hash": "Whats_App_Image_2020_10_23_at_11_55_25_AM_773f08e059",
"ext": ".jpeg",
"mime": "image/jpeg",
"size": 50.67,
"width": 590,
"height": 576,
"url": "/uploads/Whats_App_Image_2020_10_23_at_11_55_25_AM_773f08e059.jpeg",
"formats": {
"thumbnail": {
"name": "thumbnail_WhatsApp Image 2020-10-23 at 11.55.25 AM.jpeg",
"hash": "thumbnail_Whats_App_Image_2020_10_23_at_11_55_25_AM_773f08e059",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 160,
"height": 156,
"size": 5.97,
"path": null,
"url": "/uploads/thumbnail_Whats_App_Image_2020_10_23_at_11_55_25_AM_773f08e059.jpeg"
},
"small": {
"name": "small_WhatsApp Image 2020-10-23 at 11.55.25 AM.jpeg",
"hash": "small_Whats_App_Image_2020_10_23_at_11_55_25_AM_773f08e059",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 500,
"height": 488,
"size": 41.95,
"path": null,
"url": "/uploads/small_Whats_App_Image_2020_10_23_at_11_55_25_AM_773f08e059.jpeg"
}
},
"provider": "local",
"related": [
"5fbfdc7eaea26e00484a787b"
],
"createdAt": "2020-11-26T16:48:53.715Z",
"updatedAt": "2020-11-26T16:49:02.626Z",
"__v": 0,
"id": "5fbfdc75aea26e00484a787a"
}
],
"_id": "5fbfdc7eaea26e00484a787b",
"title": "I want an center table",
"description": "I want a 3x3 center table with Indian marble top",
"createdAt": "2020-11-26T16:49:02.619Z",
"updatedAt": "2020-11-26T17:23:40.655Z",
"__v": 0,
"category": {
"_id": "5fbfe21d0bbf020065dd0b1e",
"category_name": "Furniture",
"createdAt": "2020-11-26T17:13:01.743Z",
"updatedAt": "2020-11-26T17:13:01.754Z",
"__v": 0,
"id": "5fbfe21d0bbf020065dd0b1e"
},
"id": "5fbfdc7eaea26e00484a787b"
},
{
"image": [
{
"_id": "5fc073aaf41381008738f53a",
"name": "1RK-Apartment-for-Sale-in-Nalasopara-East-Mumbai-at-Sai-Krupa-Chawl-Listing-Photo_Kitchen.jpeg",
"alternativeText": "",
"caption": "",
"hash": "1_RK_Apartment_for_Sale_in_Nalasopara_East_Mumbai_at_Sai_Krupa_Chawl_Listing_Photo_Kitchen_90475427e3",
"ext": ".jpeg",
"mime": "image/jpeg",
"size": 12.22,
"width": 300,
"height": 300,
"url": "/uploads/1_RK_Apartment_for_Sale_in_Nalasopara_East_Mumbai_at_Sai_Krupa_Chawl_Listing_Photo_Kitchen_90475427e3.jpeg",
"formats": {
"thumbnail": {
"name": "thumbnail_1RK-Apartment-for-Sale-in-Nalasopara-East-Mumbai-at-Sai-Krupa-Chawl-Listing-Photo_Kitchen.jpeg",
"hash": "thumbnail_1_RK_Apartment_for_Sale_in_Nalasopara_East_Mumbai_at_Sai_Krupa_Chawl_Listing_Photo_Kitchen_90475427e3",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 156,
"height": 156,
"size": 6.45,
"path": null,
"url": "/uploads/thumbnail_1_RK_Apartment_for_Sale_in_Nalasopara_East_Mumbai_at_Sai_Krupa_Chawl_Listing_Photo_Kitchen_90475427e3.jpeg"
}
},
"provider": "local",
"related": [
"5fc07407f41381008738f53c"
],
"createdAt": "2020-11-27T03:34:02.177Z",
"updatedAt": "2020-11-27T03:35:35.325Z",
"__v": 0,
"id": "5fc073aaf41381008738f53a"
},
{
"_id": "5fc073fdf41381008738f53b",
"name": "images.jpeg",
"alternativeText": "",
"caption": "",
"hash": "images_4ba1796688",
"ext": ".jpeg",
"mime": "image/jpeg",
"size": 9.55,
"width": 351,
"height": 144,
"url": "/uploads/images_4ba1796688.jpeg",
"formats": {
"thumbnail": {
"name": "thumbnail_images.jpeg",
"hash": "thumbnail_images_4ba1796688",
"ext": ".jpeg",
"mime": "image/jpeg",
"width": 245,
"height": 101,
"size": 6.44,
"path": null,
"url": "/uploads/thumbnail_images_4ba1796688.jpeg"
}
},
"provider": "local",
"related": [
"5fc07407f41381008738f53c"
],
"createdAt": "2020-11-27T03:35:25.211Z",
"updatedAt": "2020-11-27T03:35:35.325Z",
"__v": 0,
"id": "5fc073fdf41381008738f53b"
}
],
"_id": "5fc07407f41381008738f53c",
"title": "pest control के लिए",
"description": "हमारा घर 700 वर्गफुट का है",
"createdAt": "2020-11-27T03:35:35.313Z",
"updatedAt": "2020-11-27T03:36:20.592Z",
"__v": 0,
"category": {
"_id": "5fc07424f41381008738f53f",
"category_name": "Pest Control",
"createdAt": "2020-11-27T03:36:04.739Z",
"updatedAt": "2020-11-27T03:36:04.748Z",
"__v": 0,
"id": "5fc07424f41381008738f53f"
},
"id": "5fc07407f41381008738f53c"
}
]
I now want to show Image URL and referring it in following manner in React Native.
Following is React Native code for view
<View>
{isLoading ? <ActivityIndicator/> : (
<FlatList
data={data}
keyExtractor={({ id }, index) => id}
renderItem={ renderItem }
/>
)}
</View>
and renderItem is defined as following
function renderItem({ item }) {
console.log(item.image[0].name);
}
and I get following error
undefined is not an object (evaluating 'item.image[0]')
Can you point where am I going wrong?

You're not reading data properly. As you're using nested JSON object so you can access data using the following approaches:
For Single Image:
item[0].image[0].url
For all the Images:
item.forEach(function(value, key) {
value.image.map(image => console.log(image.url));
});
I have tried your code in react native expo snack it's working fine Expo Snack Link

Related

Vega Chloropleth Map Visualisation

For some reason vega is reading my data as 0 when the numbers range from 1-234.
I am attempting to show a visualisation of a chloropleth map of crypto-ownership by country.
The countries have been ranked 1-234 and that is meant to show on the tooltip however, this is being shown as 0 on the tooltip. How do I fix this.
Here is my code:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title":{
"text": "Crypto Ownership Worldwide",
"subtitle": "Source: FILL",
"anchor": "start"
},
"width":500,
"height":400,
"data": {
"url": "https://raw.githubusercontent.com/tomiwav/tomiwav.github.io/main/custom.geo%20(3).json",
"format":{"property": "features"}
},
"projection":{"type": "mercator"},
"transform": [
{
"lookup":"properties.name",
"from":{
"key": "Country",
"fields": ["Rank"],
"data":{
"url": "https://raw.githubusercontent.com/tomiwav/tomiwav.github.io/main/datarank.csv",
"format":{"type":"csv"}
}
}
}
],
"mark":{
"type": "geoshape",
"fill":"lightgray",
"stroke":"black",
"strokeWidth":0.5
},
"encoding": {
"color": {
"field": "Rank",
"type": "quantitative",
"scale": {
"domain":[234,1],
"scheme": "oranges"
}
},
"tooltip":[
{"field":"properties.name", "title":"Country"},
{"field":"Rank","type":"quantitative","title":"Number of Crypto Owners","format":".2f"}
]
},
"config": {"mark": {"invalid": null}
}
}
Your lookup was failing. You need a lower case "c" on country.
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": {
"text": "Crypto Ownership Worldwide",
"subtitle": "Source: FILL",
"anchor": "start"
},
"width": 500,
"height": 400,
"data": {
"url": "https://raw.githubusercontent.com/tomiwav/tomiwav.github.io/main/custom.geo%20(3).json",
"format": {"property": "features"}
},
"projection": {"type": "mercator"},
"transform": [
{
"lookup": "properties.name",
"from": {
"key": "country",
"fields": ["Rank"],
"data": {
"url": "https://raw.githubusercontent.com/tomiwav/tomiwav.github.io/main/datarank.csv",
"format": {"type": "csv"}
} }
}
],
"mark": {
"type": "geoshape",
"fill": "lightgray",
"stroke": "black",
"strokeWidth": 0.5
},
"encoding": {
"color": {
"field": "Rank",
"type": "quantitative",
"scale": {"domain": [234, 1], "scheme": "oranges"}
},
"tooltip": [
{"field": "properties.name", "title": "Country"},
{
"field": "Rank",
"type": "quantitative",
"title": "Number of Crypto Owners",
"format": ".2f"
}
]
},
"config": {"mark": {"invalid": null}}
}

Flutter Create dynamic widget from dynamic json response

companyList = data['fields'][0]['choices'];
if (companyList.length != 0) {
int val;
for (val = 0; val < companyList.length; val++) {
final controller = TextEditingController();
final field = xTextfield(
txtlabel: "Values",
iconfield: bookmarksIcon,
);
setState(() {
_controllers.add(controller);
_fields.add(field);
});
}
}
But this works only if json response is same when it changes and Array object is differnet i got error here is my json that will be different everytime e.g
"inputtype": "dropdown", will make a dropdown widget and all data will be put into it and so on
{ "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": [] } ] }
You can use the Dynamic Widget package.
Just pass the widget as JSON data from the server and use a FutureBuilder to build it when your data arrives.
You will also need to change your JSON data accordingly.

retrieving array from json as a table in Kusto

I am trying to retrieve all the rows from a Json array. The json is similar to the one shown below.
{
"messageId": "123",
"fileName": "abc.json",
"payload": {
"routeStatus": "FINAL",
"activities": [
{
"durationSeconds": 1800,
"location": {
"longitude": 151.2603,
"latitude": -33.7644
},
"type": "DEPART",
"slot": {
"start": "2020-04-14T19:05:00.0000000Z",
"cost": null,
"end": "2020-04-15T03:30:00.0000000Z"
}
},
{
"durationSeconds": 1100,
"type": "DRIVE"
},
{
"durationSeconds": 360,
"location": {
"longitude": 151.21814,
"latitude": -33.756319
},
"type": "SERVICE",
"slot": {
"start": "2020-04-14T20:00:00.0000000Z",
"cost": null,
"end": "2020-04-15T00:45:00.0000000Z"
}
},
{
"durationSeconds": 164,
"type": "DRIVE"
}
],
"truck": "XYZ"
}
}
I would like to get all the attributes under the activities in a table as I would need to filter and join to other tables. I am only able to retrieve one row from the array. Any pointers would be helpful.
you can use mv-expand or mv-apply.
for example:
print d = dynamic({
"messageId": "123",
"fileName": "abc.json",
"payload": {
"routeStatus": "FINAL",
"activities": [
{
"durationSeconds": 1800,
"location": {
"longitude": 151.2603,
"latitude": -33.7644
},
"type": "DEPART",
"slot": {
"start": "2020-04-14T19:05:00.0000000Z",
"cost": null,
"end": "2020-04-15T03:30:00.0000000Z"
}
},
{
"durationSeconds": 1100,
"type": "DRIVE"
},
{
"durationSeconds": 360,
"location": {
"longitude": 151.21814,
"latitude": -33.756319
},
"type": "SERVICE",
"slot": {
"start": "2020-04-14T20:00:00.0000000Z",
"cost": null,
"end": "2020-04-15T00:45:00.0000000Z"
}
},
{
"durationSeconds": 164,
"type": "DRIVE"
}
],
"truck": "XYZ"
}
})
| mv-expand d.payload.activities
| project durationSeconds = tolong(d_payload_activities.durationSeconds), type = tostring(d_payload_activities.type)

Getting all user wallets in accounts

I writing convenience wrapper on top of the Coinbase API.
One of the requirements is to get all user accounts.
Using proper set of scopes and after a successful OAuth authentication I can use /accountsendpoint.
But the answer is confusing:
{
"data": [
{
"id": "xxxx-xxxx-xxxx-xxxx",
"name": "BTC Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "BTC",
"name": "Bitcoin",
"color": "#F7931A",
"exponent": 8,
"type": "crypto",
"sort_index": 100,
"address_regex": "^([13][a-km-zA-HJ-NP-Z1-9]{25,34})|^(bc1([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{39}|[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{59}))$"
},
"balance": {
"amount": "0.03115207",
"currency": "BTC"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "ETC",
"name": "ETC Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "ETC",
"name": "Ethereum Classic",
"color": "#59D4AF",
"exponent": 8,
"type": "crypto",
"sort_index": 103,
"address_regex": "^(?:0x)?[0-9a-fA-F]{40}$"
},
"balance": {
"amount": "0.00000000",
"currency": "ETC"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "ZRX",
"name": "ZRX Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "ZRX",
"name": "0x",
"color": "#302C2C",
"exponent": 8,
"type": "crypto",
"sort_index": 105,
"address_regex": "^(?:0x)?[0-9a-fA-F]{40}$"
},
"balance": {
"amount": "0.00000000",
"currency": "ZRX"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "BAT",
"name": "BAT Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "BAT",
"name": "Basic Attention Token",
"color": "#FF5000",
"exponent": 8,
"type": "crypto",
"sort_index": 106,
"address_regex": "^(?:0x)?[0-9a-fA-F]{40}$"
},
"balance": {
"amount": "0.00000000",
"currency": "BAT"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "USDC",
"name": "USDC Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "USDC",
"name": "USD Coin",
"color": "#2775CA",
"exponent": 6,
"type": "crypto",
"sort_index": 107,
"address_regex": "^(?:0x)?[0-9a-fA-F]{40}$"
},
"balance": {
"amount": "0.000000",
"currency": "USDC"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "ZEC",
"name": "ZEC Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "ZEC",
"name": "Zcash",
"color": "#ECB244",
"exponent": 8,
"type": "crypto",
"sort_index": 108,
"address_regex": "^(t1|t3)[a-km-zA-HJ-NP-Z1-9]{33}$"
},
"balance": {
"amount": "0.00000000",
"currency": "ZEC"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "DAI",
"name": "DAI Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "DAI",
"name": "Dai",
"color": "#FFB74D",
"exponent": 8,
"type": "crypto",
"sort_index": 115,
"address_regex": "^(?:0x)?[0-9a-fA-F]{40}$"
},
"balance": {
"amount": "0.00000000",
"currency": "DAI"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "LINK",
"name": "LINK Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "LINK",
"name": "Chainlink",
"color": "#0667D0",
"exponent": 8,
"type": "crypto",
"sort_index": 122,
"address_regex": "^(?:0x)?[0-9a-fA-F]{40}$"
},
"balance": {
"amount": "0.00000000",
"currency": "LINK"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "XRP",
"name": "XRP Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "XRP",
"name": "XRP",
"color": "#222222",
"exponent": 6,
"type": "crypto",
"sort_index": 125,
"address_regex": "^r[1-9a-km-zA-HJ-NP-Z]{25,35}$"
},
"balance": {
"amount": "0.000000",
"currency": "XRP"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "REP",
"name": "REP Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "REP",
"name": "Augur",
"color": "#553580",
"exponent": 8,
"type": "crypto",
"sort_index": 126,
"address_regex": "^(?:0x)?[0-9a-fA-F]{40}$"
},
"balance": {
"amount": "0.00000000",
"currency": "REP"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
},
{
"id": "XLM",
"name": "XLM Wallet",
"primary": true,
"type": "wallet",
"currency": {
"code": "XLM",
"name": "Stellar Lumens",
"color": "#000000",
"exponent": 7,
"type": "crypto",
"sort_index": 127,
"address_regex": "^G[A-Z2-7]{55}$"
},
"balance": {
"amount": "0.0000000",
"currency": "XLM"
},
"createdAt": null,
"updatedAt": null,
"resource": "account",
"resourcePath": null
}
]
The endpoint returns incomplete list of the user accounts. I have at least two more coinbase accounts with non zero balance.
Additionally, the id are inconsistent - for BTC we have some sort of UUID in place, while other wallets are using currency code.
This makes /transactions endpoint requests returning 404 for the requests trying to point to the different than BTC wallets:
https://api.coinbase.com/v2/accounts/EOS/transactions.
Any idea how to get full list of accounts, plus how to work with the ID for other than BTC wallets?
The scopes I am using:
("wallet:accounts:read",
"wallet:accounts:update",
"wallet:transactions:read",
"wallet:transactions:request",
"wallet:transactions:send");
I added a transaction to one of the wallets, and it was removed from next /accounts request, making it even more confusing.
Referencing the Coinbase Documentation https://developers.coinbase.com/docs/wallet/coinbase-connect/permissions
You can add the scope account = allto the permission scope. This will enable read access for all coins
https://www.coinbase.com/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&account=all&redirect_uri=YOUR_CALLBACK_URL&scope=wallet:accounts:read,wallet:transactions:read
After a day of scratching my head finally found my answer.
Attaching the accounts happens on a single wallet basis.
User needs to add BTC, XRP, ETC etc. accounts/wallets separately.
Each receives it's own TokenResponse with access and refresh token, which your application needs to manage.
Still do not understand what is the purpose of returning in /accounts endpoint remaining accounts with non usable id.

AngularJS ng-repeat display json

I'm having the hardest time figuring out how to display the following JSON file in my Angularjs repeat.
for the following JSON results, I thought I could simply display the title in an ng-repeat with the following:
<div ng-repeat="x in results">
{{x.data[0].title}}
</div>
But I'm not seeing results.
Here is the JSON:
{
"data": [
{
"id": 1,
"title": "Temp Title",
"description": "Temp Description",
"created_at": {
"date": "2016-03-15 07:10:17.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2016-03-15 07:10:17.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"user": {
"data": {
"id": 29,
"displayName": "chris.nakea",
"email": "chris.nakea#freshconsulting.com",
"join_date": 1458025279,
"profile": {
"data": {
"id": 29,
"displayName": "chris.nakea",
"avatar": null,
"firstName": null,
"lastName": null,
"bio": null,
"city": null,
"zipcode": null,
"state": null,
"country": null,
"latitude": null,
"longitude": null,
"avatars": {
"data": [
{
"id": "default_avatar.png",
"filename": "default_avatar.png",
"url": "https://cdn.band.dev/common/images/common/default_avatar.png",
"created_at": {
"date": "2016-03-15 00:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"images": {
"small": "https://cdn.band.dev/common/images/common/default_avatar_small.png",
"medium": "https://cdn.band.dev/common/images/common/default_avatar_medium.png",
"large": "https://cdn.band.dev/common/images/common/default_avatar_large.png"
}
}
]
},
"coverPhotos": {
"data": []
}
}
}
}
},
"category": {
"data": {
"id": 2,
"name": "Staff / Events",
"description": "Staff / Events",
"colorCode": "#242156",
"iconName": "icon-staff-events",
"iconCharacterCode": "c108"
}
},
"attachments": {
"data": [
{
"id": "1d3f96e2286c27ee599c9e49a0c33da0",
"filename": "man.jpg",
"url": "https://api.band.dev/v1/file/1d3f96e2286c27ee599c9e49a0c33da0",
"created_at": {
"date": "2016-03-15 07:10:17.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"images": {
"small": "https://api.band.dev/v1/file/50af58b3d52d8629e9f5c4d0dcdd5181",
"medium": "https://api.band.dev/v1/file/51535d38f7b3cd82313eac2414059d83",
"large": "https://api.band.dev/v1/file/a7be1dada18e4041cf48aea377cafa29"
}
}
]
}
},
{
"id": 2,
"title": "Temp Title",
"description": "Temp Description",
"created_at": {
"date": "2016-03-15 07:12:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2016-03-15 07:12:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"user": {
"data": {
"id": 29,
"displayName": "chris.nakea",
"email": "chris.nakea#freshconsulting.com",
"join_date": 1458025279,
"profile": {
"data": {
"id": 29,
"displayName": "chris.nakea",
"avatar": null,
"firstName": null,
"lastName": null,
"bio": null,
"city": null,
"zipcode": null,
"state": null,
"country": null,
"latitude": null,
"longitude": null,
"avatars": {
"data": [
{
"id": "default_avatar.png",
"filename": "default_avatar.png",
"url": "https://cdn.band.dev/common/images/common/default_avatar.png",
"created_at": {
"date": "2016-03-15 00:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"images": {
"small": "https://cdn.band.dev/common/images/common/default_avatar_small.png",
"medium": "https://cdn.band.dev/common/images/common/default_avatar_medium.png",
"large": "https://cdn.band.dev/common/images/common/default_avatar_large.png"
}
}
]
},
"coverPhotos": {
"data": []
}
}
}
}
},
"category": {
"data": {
"id": 2,
"name": "Staff / Events",
"description": "Staff / Events",
"colorCode": "#242156",
"iconName": "icon-staff-events",
"iconCharacterCode": "c108"
}
},
"attachments": {
"data": [
{
"id": "a93cf8df7b60686e7ca6884d0ce353c8",
"filename": "man2.jpg",
"url": "https://api.band.dev/v1/file/a93cf8df7b60686e7ca6884d0ce353c8",
"created_at": {
"date": "2016-03-15 07:12:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"images": {
"small": "https://api.band.dev/v1/file/cd04551395a355f4792fb85833156741",
"medium": "https://api.band.dev/v1/file/4ff543cd8f5055bfecd703dedaee6d87",
"large": "https://api.band.dev/v1/file/5cdd9a0c3650228e0b93f9c6cd1404df"
}
}
]
}
}
]
}
You can just remove the datap[0] part and get the output
<div ng-repeat="x in results.data">
{{x.title}}
</div>
Output:
Temp Title
Temp Title
if you want to filter then you can do it by
<div ng-repeat="x in results.data | filter: { id: '1' }">
{{x.title}}
</div>
Output:
Temp Title
<div ng-repeat="item in data">{{item.title}}</div>
And in your controller, bind the json to the scope.
$scope.data = jsonData.data;
Here's a fiddle for you - jsFiddle
<div ng-repeat="x in results.data">
{{x.title}}
</div>
https://jsfiddle.net/nvqf8oo7/6/
Thank you all for responding. I finally figured out that the reason I wasn't seeing anything was because I am using ui.bootstrap's modal and I was out of scope.
I resolved this by moving the ng-repeat out of the modal, but I could have also tried to work with the modal scope itself.

Resources