How to fetch array of array data in angular 2? - arrays

How to fetch array of array data in angular 2.
My json data is as follows,
[[{
"pk_emp_id":5,
"tenant_id":"Zone1",
"location_id":1,
"emp_number":"sk44",
"prefix":"",
"first_name":"qqqqq",
"middle_name":"www",
"last_name":"eeee",
"display_name":"qqqq",
"full_name":"qqq qqqq",
"email":"qqqq#gmail.com",
"gender":"Female",
"emp_type_id":2,
"date_of_hire":191000,
"date_of_birth":null,
"manager_id":7,
"phone_number":"9877654",
"position":"SE",
"responsibility":"",
"notes":"",
"contracted":"0",
"street":"vidyanagar",
"state":"Karnataka",
"city":"hubli",
"zip_code":"9898",
"dob":-19800000,
"ssn":"",
"deleted":0
},{
"pk_empt_id":2,
"empt_tenant_id":"2",
"***empt_name***":"temporary",
"deleted":0
}]]
How can I fetch empt_name in datatable(row data)?

let dummyArr = [
[{
"pk_emp_id": 5,
"tenant_id": "Zone1",
"location_id": 1,
"emp_number": "sk44",
"prefix": "",
"first_name": "qqqqq",
"middle_name": "www",
"last_name": "eeee",
"display_name": "qqqq",
"full_name": "qqq qqqq",
"email": "qqqq#gmail.com",
"gender": "Female",
"emp_type_id": 2,
"date_of_hire": 191000,
"date_of_birth": null,
"manager_id": 7,
"phone_number": "9877654",
"position": "SE",
"responsibility": "",
"notes": "",
"contracted": "0",
"street": "vidyanagar",
"state": "Karnataka",
"city": "hubli",
"zip_code": "9898",
"dob": -19800000,
"ssn": "",
"deleted": 0
}, {
"pk_empt_id": 2,
"empt_tenant_id": "2",
"***empt_name***": "temporary",
"deleted": 0
}]
];
dummyArr.forEach(element =>{
element.forEach(element2=>{
console.log(element2)
})
});

I believe you have exposed a GET method in your web api
In Angular using HTTP service
this.http.get("").subscribe(result => {
conosle.log(result[1].empt_name) });

You can take it in an array and read it like this:
x = [
[{
"pk_emp_id": 5,
"tenant_id": "Zone1",
"location_id": 1,
"emp_number": "sk44",
"prefix": "",
"first_name": "qqqqq",
"middle_name": "www",
"last_name": "eeee",
"display_name": "qqqq",
"full_name": "qqq qqqq",
"email": "qqqq#gmail.com",
"gender": "Female",
"emp_type_id": 2,
"date_of_hire": 191000,
"date_of_birth": null,
"manager_id": 7,
"phone_number": "9877654",
"position": "SE",
"responsibility": "",
"notes": "",
"contracted": "0",
"street": "vidyanagar",
"state": "Karnataka",
"city": "hubli",
"zip_code": "9898",
"dob": -19800000,
"ssn": "",
"deleted": 0
}, {
"pk_empt_id": 2,
"empt_tenant_id": "2",
"***empt_name***": "temporary",
"deleted": 0
}]
]
$('#a').text(x[0][1]['***empt_name***'])
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<span id='a'>sadsad </span>

This is just Javascript object manipulation.
You can do something like :
outerArray.forEach(innerArray =>{
if(innerArray.length){
innerArray.forEach(element =>{
//do somthing here with element.empt_name
console.log(element.empt_name);
});
}
})

Related

How to display a column data in a react_table when the column data is array of object?

I am using s react table to to display a table of data
In tags column I want display both the tags present in tags array
of object like this. I did tried some ways but didn't get any
success as of yet. New to tables, so any better way to do this
will be appreciated.
code-sandbox link :
CodeSandBox
[
{
"id": 1,
"first_name": "Torie",
"last_name": "Rustman",
"email": "trustman0#amazon.co.uk",
"date_of_birth": "1979-11-16T23:04:32Z",
"age": 45,
"tags": null,
"phone": "6844103517"
},
{
"id": 2,
"first_name": "Kordula",
"last_name": "Gecks",
"email": "kgecks1#deviantart.com",
"date_of_birth": "1997-08-06T21:07:34Z",
"age": 30,
"tags": null,
"phone": "8429683893"
},
{
"id": 3,
"first_name": "Vikki",
"last_name": "Simoens",
"email": "vsimoens2#ted.com",
"date_of_birth": "2016-04-28T16:59:19Z",
"age": 48,
"tags": [
{ "id": 0, "name": "tag1" },
{ "id": 1, "name": "tag2" }
],
"phone": "8672773997"
},
{
"id": 4,
"first_name": "Burnaby",
"last_name": "Cowern",
"email": "bcowern3#forbes.com",
"date_of_birth": "2017-10-25T08:05:50Z",
"age": 54,
"tags": [
{ "id": 0, "name": "tag3" },
{ "id": 1, "name": "tag4" }
],
"phone": "4257971694"
},
{
"id": 5,
"first_name": "Teddie",
"last_name": "Traice",
"email": "ttraice4#zdnet.com",
"date_of_birth": "2015-04-20T11:45:34Z",
"age": 57,
"tags": [
{ "id": 0, "name": "tag5" },
{ "id": 1, "name": "tag6" }
],
"phone": "3932158370"
},
{
"id": 7,
"first_name": "Shayna",
"last_name": "Dimitresco",
"email": "sdimitresco6#uiuc.edu",
"date_of_birth": "1997-10-28T11:25:07Z",
"age": 21,
"tags": null,
"phone": "1216713219"
}
]
You could define the cell display function when you are defining the columns like you are doing for the date field.
{
Header: "Tags",
Footer: "Tags",
accessor: "tags",
// accessor: "tags[0].name"
Cell: ({ value }) => {
const values = value ? value.map((v) => v.name + ' ') : '';
return values;
}
}
Forked sandbox here

python how to get dictionally object in json?

I start learning json. I can access title object like this
json_data = results['local_results']
for i in json_data:
if "title" in i:
title = i["title"]
How to accesss latitude object of gps_coordinates, website object of links.
here is my json data.
"local_results": [
{
"position": 1,
"title": "McDonald's",
"place_id": "2142927458143177356",
"lsig": "AB86z5W5r155sIcs3jqfYkm9Y8Fp",
"place_id_search": "https://serpapi.com/search.json?device=desktop&engine=google&gl=us&google_domain=google.com&hl=en&location=austin%2C+texas%2C+united+states&lsig=AB86z5W5r155sIcs3jqfYkm9Y8Fp&ludocid=2142927458143177356&q=McDonald%27s&tbm=lcl&token=16c37bb72affc4f2",
"address": "Austin, TX",
"phone": "(512) 442-0412",
"hours": "Open ⋅ Closes 12AM",
"gps_coordinates": {
"latitude": 30.260337999999994,
"longitude": -97.7581347
},
"links": {
"website": "https://www.mcdonalds.com/us/en-us/location/TX/AUSTIN/1209-BARTON-SPRINGS/4941.html?cid=RF:YXT:GMB::Clicks",
"directions": "https://www.google.com/maps/dir//McDonald's,+1209+Barton+Springs+Rd,+Austin,+TX+78704/data=!4m6!4m5!1m1!4e2!1m2!1m1!1s0x8644b51bd54fc423:0x1dbd352b620e0a8c?sa=X&hl=en"
}
},
Json data:
x = {"local_results": [
{
"position": 1,
"title": "McDonald's",
"place_id": "2142927458143177356",
"lsig": "AB86z5W5r155sIcs3jqfYkm9Y8Fp",
"place_id_search": "https://serpapi.com/search.json?device=desktop&engine=google&gl=us&google_domain=google.com&hl=en&location=austin%2C+texas%2C+united+states&lsig=AB86z5W5r155sIcs3jqfYkm9Y8Fp&ludocid=2142927458143177356&q=McDonald%27s&tbm=lcl&token=16c37bb72affc4f2",
"address": "Austin, TX",
"phone": "(512) 442-0412",
"hours": "Open ⋅ Closes 12AM",
"gps_coordinates": {
"latitude": 30.260337999999994,
"longitude": -97.7581347
},
"links": {
"website": "https://www.mcdonalds.com/us/en-us/location/TX/AUSTIN/1209-BARTON-SPRINGS/4941.html?cid=RF:YXT:GMB::Clicks",
"directions": "https://www.google.com/maps/dir//McDonald's,+1209+Barton+Springs+Rd,+Austin,+TX+78704/data=!4m6!4m5!1m1!4e2!1m2!1m1!1s0x8644b51bd54fc423:0x1dbd352b620e0a8c?sa=X&hl=en"
}
}]}
Coordinates extraction:
x['local_results'][0]['gps_coordinates']
Ouput:
{'latitude': 30.260337999999994, 'longitude': -97.7581347}
Website extraction:
print(x['local_results'][0]['links']['website'])
output:
https://www.mcdonalds.com/us/en-us/location/TX/AUSTIN/1209-BARTON-SPRINGS/4941.html?cid=RF:YXT:GMB::Clicks
Here is your JSON data:
data = {"local_results": [
{
"position": 1,
"title": "McDonald's",
"place_id": "2142927458143177356",
"lsig": "AB86z5W5r155sIcs3jqfYkm9Y8Fp",
"place_id_search": "https://serpapi.com/search.json?device=desktop&engine=google&gl=us&google_domain=google.com&hl=en&location=austin%2C+texas%2C+united+states&lsig=AB86z5W5r155sIcs3jqfYkm9Y8Fp&ludocid=2142927458143177356&q=McDonald%27s&tbm=lcl&token=16c37bb72affc4f2",
"address": "Austin, TX",
"phone": "(512) 442-0412",
"hours": "Open ⋅ Closes 12AM",
"gps_coordinates": {
"latitude": 30.260337999999994,
"longitude": -97.7581347
},
"links": {
"website": "https://www.mcdonalds.com/us/en-us/location/TX/AUSTIN/1209-BARTON-SPRINGS/4941.html?cid=RF:YXT:GMB::Clicks",
"directions": "https://www.google.com/maps/dir//McDonald's,+1209+Barton+Springs+Rd,+Austin,+TX+78704/data=!4m6!4m5!1m1!4e2!1m2!1m1!1s0x8644b51bd54fc423:0x1dbd352b620e0a8c?sa=X&hl=en"
}
}]}
You enter JSON information into this website (http://jsonviewer.stack.hu/) and you see your data regularly and you can easily access it.
so, here you can access the link and gps_coordinates this way:
print(data['local_results'][0]['gps_coordinates'])
print(data['local_results'][0]['links'])

How can I correct this Jolt Transformation?

This is an input that needs to be transformed using Jolt Transformation to obtain the expected output.
I am trying to write a jolt transformation for the below input.
but It's not matched with the expected output.
My Input:
{
"ConsolidatedList": [
{
"AliasType": "AKA",
"AliasTypeName": "AKA",
"BusinessRegNumber": {
"nil": null
},
"nil": null,
"Country": null,
"CountryOfBirth": "Syria",
"CurrentOwners": {
"nil": null
},
"DateListed": "2021-03-15T00:00:00",
"DateListedDay": 15,
"DateListedMonth": 3,
"DateListedYear": 2021,
"DateOfBirth": "01/09/1975",
"DateOfBirthId": 4751,
"DayOfBirth": 1,
"EmailAddress": {
"nil": null
},
"FCOId": "SYR0377",
"FlagOfVessel": {
"nil": null
},
"FullAddress": null,
"FullName": " Al Shebil Luna ",
"FurtherIdentifiyingInformation": {
"nil": null
},
"Gender": "Female",
"GroupID": 14070,
"GroupStatus": "Asset Freeze Targets",
"GroupTypeDescription": "Individual",
"GrpStatus": "A",
"HIN": {
"nil": null
},
"ID": 33233,
"IMONumber": {
"nil": null
},
"LastUpdated": "2021-03-15T00:00:00",
"LastUpdatedDay": 15,
"LastUpdatedMonth": 3,
"LastUpdatedYear": 2021,
"LengthOfVessel": {
"nil": null
},
"ListingType": "UK autonomous",
"MonthOfBirth": 9,
"Name6": "Al Shebil",
"NameTitle": null,
"NationalIdNumber": {
"nil": null
},
"Nationality": "Syria",
"OrgType": {
"nil": null
},
"OtherInformation": "MapRecord[{{http://www.w3.org/2001/XMLSchema-instance}nil=true}]",
"ParentCompany": {
"nil": null
},
"PassportDetails": "MapRecord[{{http://www.w3.org/2001/XMLSchema-instance}nil=true}]",
"PhoneNumber": {
"nil": null
},
"Position": "Media Adviser to President Assad",
"PostCode": null,
"PreviousFlags": {
"nil": null
},
"PreviousOwners": {
"nil": null
},
"RegimeName": "Syria",
"Subsidiaries": {
"nil": null
},
"TonnageOfVessel": {
"nil": null
},
"TownOfBirth": "Suweida",
"TypeOfVessel": {
"nil": null
},
"UKStatementOfReasons": "Adviser to President Assad and a prominent member of his inner circle. As Media Adviser to the President she supports the Syrian regime, which relies on disinformation and a lack of media freedom to repress the civilian population. She is also associated with the Syrian regime through her role as an adviser.\n",
"Website": {
"nil": null
},
"YearBuilt": {
"nil": null
},
"YearOfBirth": 1975,
"address1": null,
"address2": null,
"address3": null,
"address4": null,
"address5": null,
"address6": null,
"name1": "Luna",
"name2": null,
"name3": null,
"name4": null,
"name5": null
},
{
"AliasType": "AKA",
"AliasTypeName": "AKA",
"BusinessRegNumber": {
"nil": null
},
"nil": null,
"Country": null,
"CountryOfBirth": "Syria",
"CurrentOwners": {
"nil": null
},
"DateListed": "2021-03-15T00:00:00",
"DateListedDay": 15,
"DateListedMonth": 3,
"DateListedYear": 2021,
"DateOfBirth": "01/09/1975",
"DateOfBirthId": 4751,
"DayOfBirth": 1,
"EmailAddress": {
"nil": null
},
"FCOId": "SYR0377",
"FlagOfVessel": {
"nil": null
},
"FullAddress": null,
"FullName": " Al Shebil Luna ",
"FurtherIdentifiyingInformation": {
"nil": null
},
"Gender": "Female",
"GroupID": 14070,
"GroupStatus": "Asset Freeze Targets",
"GroupTypeDescription": "Individual",
"GrpStatus": "A",
"HIN": {
"nil": null
},
"ID": 33233,
"IMONumber": {
"nil": null
},
"LastUpdated": "2021-03-15T00:00:00",
"LastUpdatedDay": 15,
"LastUpdatedMonth": 3,
"LastUpdatedYear": 2021,
"LengthOfVessel": {
"nil": null
},
"ListingType": "UK autonomous",
"MonthOfBirth": 9,
"Name6": "Al Shebil",
"NameTitle": null,
"NationalIdNumber": {
"nil": null
},
"Nationality": "Syria",
"OrgType": {
"nil": null
},
"OtherInformation": "MapRecord[{{http://www.w3.org/2001/XMLSchema-instance}nil=true}]",
"ParentCompany": {
"nil": null
},
"PassportDetails": "MapRecord[{{http://www.w3.org/2001/XMLSchema-instance}nil=true}]",
"PhoneNumber": {
"nil": null
},
"Position": "Media Adviser to President Assad",
"PostCode": null,
"PreviousFlags": {
"nil": null
},
"PreviousOwners": {
"nil": null
},
"RegimeName": "Syria",
"Subsidiaries": {
"nil": null
},
"TonnageOfVessel": {
"nil": null
},
"TownOfBirth": "Suweida",
"TypeOfVessel": {
"nil": null
},
"UKStatementOfReasons": "Adviser to President Assad and a prominent member of his inner circle. As Media Adviser to the President she supports the Syrian regime, which relies on disinformation and a lack of media freedom to repress the civilian population. She is also associated with the Syrian regime through her role as an adviser.\n",
"Website": {
"nil": null
},
"YearBuilt": {
"nil": null
},
"YearOfBirth": 1975,
"address1": null,
"address2": null,
"address3": null,
"address4": null,
"address5": null,
"address6": null,
"name1": "Hassan",
"name2": "Muh",
"name3": "Cane",
"name4": null,
"name5": null
}
]
}
And the expected output is -
{
"Count": "2", // Counter for the number of records
"LastUpdated": "08/03/2020 12:00:00",
"RecordType": [
"Entity",
"Individual",
"Vessel"
],
"Pages": "1",
"Records": [
{
"_id": "1", // Counter
"AdditionalInformation": "Other Information: (UK Sanctions List Ref):AQD0081 (UN Ref):QDe.014 (Further Identifiying Information):Headed by Abdelmalek Droukdel (QDi.232).Zone of operation includes Algeria and parts of Mali, Mauritania, Niger, Tunisia and Morocco.Review pursuant to Security Council resolution 1822 (2008) was concluded on 21 Jun.2010.INTERPOL-UN Security Council Special Notice web link: https://www.interpol.int/en/notice/search/une/5278467; Listed On: 10/10/2001; Last Updated: 12/31/2020; Group ID: 7247",
"RecordType": "Entity",
"Names": [
{
"_id": "1", //counter
"OtherName": "THE ORGANIZATION OF AL-QAIDA IN THE ISLAMIC MAGHREB",
"UnparsedName": "",
"FirstName": "",
"LastName": "",
"NameType": "Primary"
},
{
"_id": "2",
"OtherName": "AL QAIDA AU MAGHREB ISLAMIQUE (AQMI)",
"UnparsedName": "",
"FirstName": "",
"LastName": "",
"NameType": "Alias"
},
{
"_id": "3",
"OtherName": "AQIM",
"UnparsedName": "",
"FirstName": "",
"LastName": "",
"NameType": "Alias"
},
{
"_id": "4",
"OtherName": "LE GROUPE SALAFISTE POUR LA PREDICATION ET LE COMBAT (GSPC)",
"UnparsedName": "",
"FirstName": "",
"LastName": "",
"NameType": "Formerly Known As"
},
{
"_id": "5",
"OtherName": "SALAFIST GROUP FOR CALL AND COMBAT",
"UnparsedName": "",
"FirstName": "",
"LastName": "",
"NameType": "Formerly Known As"
}
],
"Addresses": [
{
"_id": "1",
"PostalCode": "",
"Street": "",
"City": "",
"StateProvince": "",
"Country": {
"Name": "Algeria",
"RelationType": "Address"
}
},
{
"_id": "2",
"PostalCode": "",
"Street": "",
"City": "",
"StateProvince": "",
"Country": {
"Name": "Mali",
"RelationType": "Address"
}
},
{
"_id": "3",
"PostalCode": "",
"Street": "",
"City": "",
"StateProvince": "",
"Country": {
"Name": "Mauritania",
"RelationType": "Address"
}
},
{
"_id": "4",
"PostalCode": "",
"Street": "",
"City": "",
"StateProvince": "",
"Country": {
"Name": "Morocco",
"RelationType": "Address"
}
},
{
"_id": "5",
"PostalCode": "",
"Street": "",
"City": "",
"StateProvince": "",
"Country": {
"Name": "Niger",
"RelationType": "Address"
}
},
{
"_id": "6",
"PostalCode": "",
"Street": "",
"City": "",
"StateProvince": "",
"Country": {
"Name": "Tunisia",
"RelationType": "Address"
}
}
],
"Sanctions": [
{
"_id": "1",
"Sanction": "HM Treasury Al-Qaida Sanction",
"ExpirationDate": "",
"SanctionDate": ""
}
]
},
{
"_id": "2",
"AdditionalInformation": "Other Information: (UK Sanctions List Ref):AFG0110 (UN Ref): TAi.142 (Further Identifiying Information):Review pursuant to Security Council resolution 1822 (2008) was concluded on 29 Jul. 2010. INTERPOL-UN Security Council Special Notice web link: https://www.interpol.int/en/How-we-work/Notices/View-UN-Notices-Individuals click here.; Listed On: 02/23/2001; Last Updated: 2/1/2021; Group ID: 6895",
"RecordType": "Person",
"Names": [
{
"_id": "1",
"OtherName": "",
"UnparsedName": "",
"FirstName": "Abdul Hai Hazem",
"LastName": "ABDUL QADER",
"NameType": "Primary"
},
{
"_id": "2",
"OtherName": "",
"UnparsedName": "",
"FirstName": "Abdul Hai",
"LastName": "HAZEM",
"NameType": "Alias"
}
],
"Identifiers": [
{
"_id": "1",
"IDValue": "1971",
"IDType": "Date Of Birth"
},
{
"_id": "2",
"IDValue": "Pashawal Yargatoo village, Andar District, Ghazni Province, Afghanistan",
"IDType": "Place Of Birth"
},
{
"_id": "3",
"IDValue": "D 0001203 (Afghan)",
"IDType": "Passport"
}
],
"Addresses": [
{
"_id": "1",
"PostalCode": "",
"Street": "",
"City": "",
"StateProvince": "Kabul Province",
"Country": {
"Name": "Afghanistan",
"RelationType": "Address"
}
},
{
"_id": "2",
"PostalCode": "",
"Street": "",
"City": "Kabul City",
"StateProvince": "Kabul Province",
"Country": {
"Name": "",
"RelationType": "Address"
}
},
{
"_id": "3",
"PostalCode": "",
"Street": "",
"City": "",
"StateProvince": "",
"Country": {
"Name": "Afghan",
"RelationType": "Nationality"
}
}
],
"Sanctions": [
{
"_id": "1",
"Sanction": "HM Treasury Afghanistan Sanction",
"ExpirationDate": "",
"SanctionDate": ""
}
]
}
]
}
My spec is -
[
{
"operation" : "shift",
"spec": {
"ConsolidatedList": {
"*": {
"GroupTypeDescription": "RecordType",
"LastUpdated": "LastUpdated",
"UKStatementOfReasons": "Records.AdditionalInformation",
"Name6": "Records.Names.[&1].Other Name",
"name3": "Records.Names.[&1].UnparsedName",
"name1": "Records.Names.[&1].FirstName",
"name2": "Records.Names.[&1].LastName",
"AliasType": "Records.Names.[&1].NameType",
"PostCode": "Records.Address.[&1].PostalCode",
"address2": "Records.Address.[&1].Street",
"address6": "Records.Address.[&1].City",
"Country": "Records.Address.[&1].StateProvince",
"CountryOfBirth": "Records.Address.[&1].Country.Name"
}
}
}
},
{
"operation": "modify-overwrite-beta",
"spec" : {
"Count": "size(1,Records)",
"Pages": "1"
}
}
]
The spec is not transforming as expected output.

How to create a JSON structure in ReactJS

I have a use-case to create a JSON structure in React in order to POST an API request. The JSON structure body contains objects and arrays.
Please let me know how to create it in ReactJS.
Below is the sample JSON structure that needs to be created using ReactJS:-
{
"transactionAmount": {
"currency": "INR",
"value": 1220.38
},
"transactionDate": "2020-05-18T00:00:00Z",
"tripData": {
"agencyBooked": false,
"legs": [
{
"endLocation": {
"countryCode": "IN",
"city": "Delhi",
"name": "Indira Gandhi International"
},
"startDate": "2020-05-22",
"startTime": "08:00",
"returnLeg": false,
"startLocation": {
"countryCode": "US",
"city": "San Francisco",
"name": "San Francisco International"
},
"endTime": "21:00",
"endDate": "2020-05-22",
"startLocationDetail": "none"
},
{
"endLocation": {
"countryCode": "US",
"city": "San Francisco",
"name": "San Francisco International"
},
"returnLeg": true,
"startDate": "2020-05-24",
"startLocation": {
"countryCode": "IN",
"city": "Delhi",
"name": "Indira Gandhi International"
},
"startTime": "17:00"
}
],
"segmentType": {
"category": "REQ_SEG_AIRFR",
"code": "AIRFR"
},
"selfBooked": false,
"tripType": "ROUND_TRIP"
}
}
You can simply make a JSON format like this.
const dummyObject = {
name: 'Dummy',
age: 22,
about: {
hobbies: ['soccer']
},
works: true
}

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