showing File System Structure using JSON in angularJS - javascript

I need a JSON array which contains a sample file system with corresponding attributes(type, name, size, created, modified, last_accessed etc.). Then I want to plot it as a web file system in a tree structure.
So, how will my JSON be look like & how should I make that tree in angularJS?
Editions:
I made JSON as -
{
"data" : {
"path":[
"My Files",
"Documents"
],
"data" : [
{
"name": "Work Documents",
"type": "folder",
"owner": "me",
"size": "",
"modified": "May 24, 2017",
"opened": "May 22, 2017",
"created": "May 22, 2017",
"extention": "",
"location": "My Files > Documents",
"offline": true,
"children" : [
{
"name": "Public Documents",
"type": "folder",
"owner": "public",
"size": "",
"modified": "July 8, 2015",
"opened": "July 8, 2015",
"created": "July 8, 2015",
"extention": "",
"location": "My Files > Documents",
"offline": true
},
{
"name": "Ongoing projects",
"type": "document",
"owner": "Emily Bennett",
"size": "1.2 Mb",
"modified": "July 8, 2015",
"opened": "July 8, 2015",
"created": "July 8, 2015",
"extention": "",
"location": "My Files > Documents",
"offline": true,
"preview": "assets/images/etc/sample-file-preview.jpg"
},
{
"name": "Shopping list",
"type": "document",
"owner": "Emily Bennett",
"size": "980 Kb",
"modified": "July 8, 2015",
"opened": "July 8, 2015",
"created": "July 8, 2015",
"extention": "",
"location": "My Files > Documents",
"offline": true,
"preview": "assets/images/etc/sample-file-preview.jpg"
}
]
},
{
"name": "Private Documents",
"type": "folder",
"owner": "me",
"size": "",
"modified": "July 8, 2015",
"opened": "July 8, 2015",
"created": "July 8, 2015",
"extention": "",
"location": "My Files > Documents",
"offline": true
}
]
}
}
But how can I iterate it in html ? I'm currently displaying it, but unable to understand how to show 'Children' on click of folder. This is my html -
<tr ng-repeat="file in vm.data | filter:global.search" ng-click="vm.select(file)" ng-class="{'selected' : vm.selected === file}">
<td class="file-icon">
<i class="icon-{{file.type}}"></i>
</td>
<td class="name">{{file.name}}</td>
<td class="type" hide show-gt-sm>{{file.type}}</td>
<td class="owner" hide-xs>{{file.owner}}</td>
<td class="size" hide-xs>{{file.size === '' ? '-': file.size}}</td>
<td class="last-modified" hide show-gt-md>{{file.modified}}</td>
<td class="show-details" hide-gt-md>
<md-button class="md-icon-button sidenav-toggle" ng-click="vm.toggleDetails(file)" aria-label="Details" translate translate-attr-aria-label="FM.DETAILS">
<md-icon md-font-icon="icon-information-outline"></md-icon>
</md-button>
</td>
</tr>

You can create a Json like this if it fullfil your requirements. Suppose you have a root dir of name root and it has child dirs books and videos.
Var root = {
dirName: "root",
metadata: {
size: " 1 gb",
type: "dir",
last_modified: " 24 may 2017",
// Other attributes
},
children: [
{
dirName: "books",
metadata: {
size: " 10 mb",
type: "dir",
last_modified: " 24 may 2017",
// Other attributes
},
Children:{}
},
{
dirName: "videos",
metadata: {
size: " 10 mb",
type: "dir",
last_modified: " 24 may 2017",
// Other attributes
}
}
]
}
You can now modify it as per your needs

I used this to display tree structure - https://github.com/eu81273/angular.treeview

Related

Nested ngFor only returns last item on inner ngFor

I am trying to loop through firebase RTDB reference to retrieve a list and then use those results in a subsequent firestore query. the console logs the correct data but my code only displays the last item in the loop in the inside ngFor. Any help would be appreciated. Thanks
this.ref = firebase.database().ref('stations/');
this.ref.on('value', resp => {
this.infos = [];
this.infos = snapshotToArray(resp);
});
const snapshotToArray = snapshot => {
let returnArr = [];
snapshot.forEach(childSnapshot => {
let item = childSnapshot.val();
item.key = childSnapshot.key;
returnArr.push(item.StationtName);
let sku = item.StationtName;
this.queues = this.afs.collection('projects', ref => ref.where('station', '==', item.StationtName)).valueChanges()
});
return returnArr;
}
html:
<div *ngFor="let info of infos">
{{info}}
<div *ngFor="let queue of queues | async">
<ion-button> {{queue.SKU}}</ion-button>
</div>
</div>
json and new error:
ERROR Error: Cannot find a differ supporting object '[
{
"SKU": "908897",
"buyerEmail": "m",
"comments": "c",
"createdAt": 1550285024451,
"queue": 1,
"station": "The Warehouse",
"timeTest": "Fri Feb 15 2019",
"type": "Project"
}
]' of type 'string'. NgFor only supports binding to Iterables such as Arrays.
this.infos:
["Lathe", "Press 1", "Press 2", "Mill 1", "Mill 2", "Ready", "Plasma", "Grinding", "Grinding", "Flange shop", "the office", "The Warehouse"]
added an .subscribe() to this.queues and got the correct info logged to the console on every loop. The associated projects for each station are printed to the console. Here is one of them;
["09987", "66553", "3", "98774", "4", "987654321", "1", "6533343434343"]
these are all SKU's that are associated with each station.
Here is the subscribe code I added to get the value of the observable, now Im getting another error though:
.subscribe(data=>{
console.log(data);
this.items = data.map(function (obj) {
return obj.SKU;
});
console.log(this.items);
// this.stationArr.push(this.item);
})
The error I'm getting now is:
Error: InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe'
And this in the the chrome inspector:
<!--bindings={
"ng-reflect-ng-for-of": null
}-->
current output:
Lathe
----- 908897
Press 1
----- 908897
Press 2
----- 908897
Mill 1
----- 908897
Mill 2
----- 908897
Ready
----- 908897
Plasma
----- 908897
Grinding
----- 908897
Grinding
----- 908897
Flange shop
----- 908897
the office
----- 908897
The Warehouse
----- 908897
desired output:
Lathe
----- 908897
Press 1
----- 123432,5476344
Press 2
----- empty
Mill 1
----- 0987654, 7777777, 673654
Mill 2
----- 12321
Ready
----- 909090990, 878787878, 67767
etc.
each station has a SKU associated, but my code displays the same one for each station.
json file:
[{
"id": "0rikFyAEt4Zg83sPeUNG",
"SKU": "88",
"buyerEmail": "",
"comments": "",
"createdAt": 1550297319125,
"queue": 1,
"station": "Press 1",
"timeTest": "Sat Feb 16 2019",
"type": "Project"
}, {
"id": "1UJftXBqdmvjwJAs2XO5",
"SKU": "77777e7e7",
"buyerEmail": "b",
"comments": "c",
"createdAt": 1550291447696,
"queue": 1,
"station": "Lathe",
"timeTest": "Fri Feb 15 2019",
"type": "Project"
}, {
"id": "1aFkV5z0JBzfii0edQCd",
"SKU": "911111111",
"buyerEmail": "matt#duhon.com",
"comments": "comment",
"createdAt": 1550286952568,
"queue": 1,
"station": "Grinding",
"stations": ["Addy"],
"timeTest": "Fri Feb 15 2019",
"type": "Project"
}, {
"id": "5BylWSmtH02v8oCq7T2B",
"SKU": "123456789",
"buyerEmail": "MAtts",
"comments": "comment",
"createdAt": 1550372243065,
"queue": 1,
"station": "Press 1",
"timeTest": "Sat Feb 16 2019",
"type": "Project"
}, {
"id": "BVNaMjK5oqSslnfE6Uar",
"SKU": "11111111",
"buyerEmail": "",
"comments": "",
"createdAt": 1550290392880,
"queue": 1,
"station": "Mill",
"timeTest": "Fri Feb 15 2019",
"type": "Project"
}, {
"id": "HvxQF4suTBaiCwpWgf9D",
"SKU": "908897",
"buyerEmail": "m",
"comments": "c",
"createdAt": 1550285024451,
"queue": 1,
"station": "The Warehouse",
"timeTest": "Fri Feb 15 2019",
"type": "Project"
}, {
"id": "KfJ4qvVyDzVwFxIeMRzM",
"SKU": "09987",
"buyerEmail": "",
"comments": "",
"createdAt": 1550286034246,
"queue": 1,
"station": "Ready",
"timeTest": "Fri Feb 15 2019",
"type": "Project"
}, {
"id": "MrrioE5IHpImz52qnHW5",
"SKU": "1211221",
"buyerEmail": "",
"comments": "",
"createdAt": 1550290371569,
"queue": 1,
"station": "Lathe",
"timeTest": "Fri Feb 15 2019",
"type": "Project"
}, {
"id": "TczmkayGuWonT6SQZf6F",
"SKU": "3",
"buyerEmail": "",
"comments": "3 years old yo!",
"createdAt": 1550298020154,
"queue": 1,
"station": "Ready",
"timeTest": "Sat Feb 16 2019",
"type": "Project"
}, {
"id": "ZspOz31o0uYT0Msull5J",
"SKU": "909987",
"buyerEmail": "matt#duhon.com",
"comments": "comment",
"createdAt": 1550286926441,
"queue": 1,
"station": "Packaging",
"timeTest": "Fri Feb 15 2019",
"type": "Project"
}, {
"id": "hXC1uswgbW1UVTfVD96k",
"SKU": "98774",
"buyerEmail": "matt#duhon.com",
"comments": "comments",
"createdAt": 1550296878271,
"queue": 1,
"station": "Ready",
"timeTest": "Sat Feb 16 2019",
"type": "Project"
}, {
"id": "jeR8wCiPdCwObZvajT04",
"SKU": "4",
"buyerEmail": "matt",
"comments": "comments",
"createdAt": 1550298181612,
"queue": 1,
"station": "Ready",
"timeTest": "Sat Feb 16 2019",
"type": "Project"
}, {
"id": "lx2Hh3rpQ1rLkGHAgEzo",
"SKU": "987654321",
"buyerEmail": "yomama",
"comments": "com mints",
"createdAt": 1550296669267,
"queue": 1,
"station": "Ready",
"timeTest": "Fri Feb 15 2019",
"type": "Project"
}, {
"id": "qAYSdYYC2wxBwYDYI71T",
"SKU": "1",
"buyerEmail": "",
"comments": "",
"createdAt": 1550297026128,
"queue": 1,
"station": "Ready",
"timeTest": "Sat Feb 16 2019",
"type": "Project"
}, {
"id": "sBXhW6lPaYtUn4fz5Gsf",
"SKU": "6533343434343",
"buyerEmail": "MAtt",
"comments": "Comment",
"createdAt": 1550372086063,
"queue": 1,
"station": "Ready",
"timeTest": "Sat Feb 16 2019",
"type": "Project"
}]
As per you code check this Demo code where you can see the nested *ngFor
<ul>
<li *ngFor="let info of infos">{{info}}
<ol *ngFor="let queue of queues | async">{{queue.SKU}}</ol>
</li>
</ul>

Java script inner array response parsing

I am new to javascript. i want to parse this response .
var date=[];
var details=[];
for(post in resulttable.posts){
date=date.concat(resulttable.posts[post].days.Date);
details= details.concat(resulttable.posts[post].days.details);
}
I dont know where am missing. please help me , I want those details in one array and dates to be another array.
{
"status": 1,
"count": 2,
"posts": [{
"days": {
"details": [{
"place": "labs",
"StartTime": "01:00:00",
"EndTime": "02:00:00",
"Description": "Meeting with team",
"participants": [{
"Name": "KK",
"Designation": "VP, Operations",
"ContactNumber": "111"
}, {
"Name": "MN1",
"Designation": "Project Lead",
"ContactNumber": "111"
}]
}],
"Date": ["2017-02-02"]
},
"name": "test"
}, {
"days": {
"details": [{
"place": "India",
"StartTime": "01:00:00",
"EndTime": "03:00:00",
"Description": "Agenda1",
"participants": [{
"Name": "Kk",
"Designation": "VP, Operations",
"ContactNumber": "11111"
}, {
"Name": "MN",
"Designation": "Project Lead",
"ContactNumber": "111"
}]
}, {
"place": "microsoft",
"StartTime": "01:00:00",
"EndTime": "02:00:00",
"Description": "Meet CEO",
"participants": [{
"Name": "VR",
"Designation": "Project Lead",
"ContactNumber": "111"
}]
}, {
"place": "microsoft",
"StartTime": "01:00:00",
"EndTime": "02:00:00",
"Description": "Meet CEO",
"participants": [{
"Name": " VR",
"Designation": "Project Lead",
"ContactNumber": "111"
}]
}, {
"place": "Formule",
"StartTime": "10:50:00",
"EndTime": "11:50:00",
"Description": "Meet Rajesh",
"participants": [{
"Name": "MN",
"Designation": "Project Lead",
"ContactNumber": "111"
}]
}, {
"place": "Dell",
"StartTime": "04:00:00",
"EndTime": "08:00:00",
"Description": "Agenda 2",
"participants": [{
"Name": "MN",
"Designation": "Project Lead",
"ContactNumber": "1111111"
}]
}],
"Date": ["2017-02-03"]
},
"name": "test"
}]
}
Check this fiddle
var details = new Array();
var dates = new Array();
for (var i = 0; i < resulttable.posts.length; i++) {
dates = dates.concat(resulttable.posts[i].days.Date);
details = details.concat(resulttable.posts[i].days.details);
}
console.log(details);
console.log(dates);
Or
var details = new Array();
var dates = new Array();
for (post of resulttable.posts) {
dates = dates.concat(post.days.Date);
details = details.concat(post.days.details);
}
console.log(details);
console.log(dates);

export json to xls doc in java/ js

I'm trying to export json data into an Excel file. My json is not consistent which is why I have problem because the excel mapping is all scattered and the columns are messed up. Here is a sample JSON I'm working on:
[
{
"path": "/conte/nt",
"title": "First",
"date": "January 14, 2015 8:59:57 PM EST"
},
{
"path": "/content/o",
"title": "Third Annual",
"date": "January 14, 2015 8:59:57 PM EST"
},
{
"path": "/co/en",
"title": "Motivating Factors",
"date": "January 14, 2015 8:59:57 PM EST"
},
{
"path": "/con/ent",
"title": "Meeting",
"description": "test",
"date": "January 14, 2015 8:59:57 PM EST",
"key": "xyz, abc"
}
]

Parsing json string to an array

What i need to do here is whenever i call a method say for campaign data it needs to go to "name" : "campaign " and give me "values" in this format
{"car":"car",
"bus":"bus",
"truck":"truck",
"train":"train"}
in the same way i need for sub campaign . (Comment if anything is unclear)
{
"fields": [
{
"name": "campaign",
"default": "",
"values": [
"car",
"bus",
"truck",
"train"
]
},
{
"name": "subCampaign",
"default": "",
"values": [
"Spring 2015",
"BTS 2015",
"BTS 2014",
"Holiday 2015",
"Holiday 2014"
]
},
]
}
If we have
var obj ={
"fields": [
{
"name": "campaign",
"default": "",
"values": [
"car",
"bus",
"truck",
"train"
]
},
{
"name": "subCampaign",
"default": "",
"values": [
"Spring 2015",
"BTS 2015",
"BTS 2014",
"Holiday 2015",
"Holiday 2014"
]
},
]
};
You can do it like this, say for `campaign, you can use:
var result = {};
obj.fields[0].values.forEach(function(val){
result[val] = val
});
This would give result as object having value : {car: "car", bus: "bus", truck: "truck", train: "train"}
Assuming you want {"car":"car", "bus":"bus","truck":"truck","train":"train"}
var object = {
"fields": [{
"name": "campaign",
"default": "",
"values": [
"car",
"bus",
"truck",
"train"]
},
{
"name": "subCampaign",
"default": "",
"values": [
"Spring 2015",
"BTS 2015",
"BTS 2014",
"Holiday 2015",
"Holiday 2014"]
}, ]
};
var passingObj = object.fields[0].values;
alert(JSON.stringify(getObj(passingObj)));
function getObj(passingObj) {
var obj = {};
for (var index in passingObj) {
obj[passingObj[index]] = passingObj[index];
}
return obj;
}

Javascript & Nested JSON issues

So I'm trying to put together some JSON and parse it out into jquery but I am doing something wrong with my JSON syntax. I tried running it through a validator but it doesn't really tell me what I'm doing wrong. Can somebody point out the error of my ways?
var searchresults = [
{
"providerlisting": [
{
"nametitle": "Cory M Spears, MD, FACP",
"caretype": "Internal Medicine",
"preferredProvider": true,
"address1": "289 N. Highland Ave.",
"address2": "",
"cityStateZip": "Atlanta, GA 30306",
"coverage": "/images/example.png",
"status": "Out of Network",
"psn": "",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere",
},
{
"nametitle": "Jimmy Dean, MD, FACP",
"caretype": "External Medicine",
"preferredProvider": false,
"address1": "3 Piedmont Rd.",
"address2": "",
"cityStateZip": "Atlanta, GA 30706",
"coverage": "/images/example2.png",
"status": "In Network",
"psn": "urlhere",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere",
},
{
"nametitle": "John Doe, DD, PM",
"caretype": "Internal Medicine",
"preferredProvider": true,
"address1": "500 Ponce De Leon Ave",
"address2": "Suite 5",
"cityStateZip": "Atlanta, GA 30706",
"coverage": "/images/example2.png",
"status": "Out of Network",
"psn": "urlhere",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere",
}]
},
{
"categories": [{
"categoryMenu": [
{
"providertype": [
{
"title": "Doctor",
"link": "#doctor",
"amount": "400"
},
{
"title": "Hospital",
"link": "#hospital",
"amount": "40"
},
{
"title": "Urgent Care",
"link": "#urgentCare",
"amount": "37"
}
]
},
{
"specialty": [
{
"title": "Allergy and Immunology",
"link": "#allergyAndImmunology",
"amount": "2"
},
{
"title": "Audiology",
"link": "#audiology",
"amount": "3"
},
{
"title": "Allergy and Immunology",
"link": "#allergyAndImmunology",
"amount": "6"
},
{
"title": "Ambulatory Surgical Center",
"link": "#ambulatorySurgicalCenter",
"amount": "4"
}
]
},
{
"gender": [
{
"title": "Male",
"link": "#male",
"amount": "67"
},
{
"title": "Female",
"link": "#female",
"amount": "3"
}
]
}
}]
}];
Remove the , at the end of each
"rating": "urlhere"
there was a ] missing on the third last line, below is a valid json object
var searchresults = [{
"providerlisting": [{
"nametitle": "Cory M Spears, MD, FACP",
"caretype": "Internal Medicine",
"preferredProvider": true,
"address1": "289 N. Highland Ave.",
"address2": "",
"cityStateZip": "Atlanta, GA 30306",
"coverage": "/images/example.png",
"status": "Out of Network",
"psn": "",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere"
}, {
"nametitle": "Jimmy Dean, MD, FACP",
"caretype": "External Medicine",
"preferredProvider": false,
"address1": "3 Piedmont Rd.",
"address2": "",
"cityStateZip": "Atlanta, GA 30706",
"coverage": "/images/example2.png",
"status": "In Network",
"psn": "urlhere",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere"
}, {
"nametitle": "John Doe, DD, PM",
"caretype": "Internal Medicine",
"preferredProvider": true,
"address1": "500 Ponce De Leon Ave",
"address2": "Suite 5",
"cityStateZip": "Atlanta, GA 30706",
"coverage": "/images/example2.png",
"status": "Out of Network",
"psn": "urlhere",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere"
}]
}, {
"categories": [{
"categoryMenu": [{
"providertype": [{
"title": "Doctor",
"link": "#doctor",
"amount": "400"
}, {
"title": "Hospital",
"link": "#hospital",
"amount": "40"
}, {
"title": "Urgent Care",
"link": "#urgentCare",
"amount": "37"
}]
}, {
"specialty": [{
"title": "Allergy and Immunology",
"link": "#allergyAndImmunology",
"amount": "2"
}, {
"title": "Audiology",
"link": "#audiology",
"amount": "3"
}, {
"title": "Allergy and Immunology",
"link": "#allergyAndImmunology",
"amount": "6"
}, {
"title": "Ambulatory Surgical Center",
"link": "#ambulatorySurgicalCenter",
"amount": "4"
}]
}, {
"gender": [{
"title": "Male",
"link": "#male",
"amount": "67"
}, {
"title": "Female",
"link": "#female",
"amount": "3"
}]
}]
}]
}];
There are only , commas after a key/value pairs in objects if there is another one following it. (Same goes for Arrays as well)
For example:
var a = {
key : 'value',
keyB : 'value' // <-- there is no trailing comma before an object ends
};
Do you know http://jsonlint.com/?
You have to realise, an object in javascript is nearly the same like an associative array.
I think you should read a bit more about Objects and Arrays in Javascript.
Try this:
var searchresults = {
"providerlisting": [
{
"nametitle": "Cory M Spears, MD, FACP",
"caretype": "Internaenter code herel Medicine",
"preferredProvider": true,
"address1": "289 N. Highland Ave.",
"address2": "",
"cityStateZip": "Atlanta, GA 30306",
"coverage": "/images/example.png",
"status": "Out of Network",
"psn": "",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere"
},
{
"nametitle": "Jimmy Dean, MD, FACP",
"caretype": "External Medicine",
"preferredProvider": false,
"address1": "3 Piedmont Rd.",
"address2": "",
"cityStateZip": "Atlanta, GA 30706",
"coverage": "/images/example2.png",
"status": "In Network",
"psn": "urlhere",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere"
},
{
"nametitle": "John Doe, DD, PM",
"caretype": "Internal Medicine",
"preferredProvider": true,
"address1": "500 Ponce De Leon Ave",
"address2": "Suite 5",
"cityStateZip": "Atlanta, GA 30706",
"coverage": "/images/example2.png",
"status": "Out of Network",
"psn": "urlhere",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere"
}
],
"categories": {
"categoryMenu": {
"providertype": [
{
"title": "Doctor",
"link": "#doctor",
"amount": "400"
},
{
"title": "Hospital",
"link": "#hospital",
"amount": "40"
},
{
"title": "Urgent Care",
"link": "#urgentCare",
"amount": "37"
}
],
"specialty": [
{
"title": "Allergy and Immunology",
"link": "#allergyAndImmunology",
"amount": "2"
},
{
"title": "Audiology",
"link": "#audiology",
"amount": "3"
},
{
"title": "Allergy and Immunology",
"link": "#allergyAndImmunology",
"amount": "6"
},
{
"title": "Ambulatory Surgical Center",
"link": "#ambulatorySurgicalCenter",
"amount": "4"
}
],
"gender": [
{
"title": "Male",
"link": "#male",
"amount": "67"
},
{
"title": "Female",
"link": "#female",
"amount": "3"
}
]
}
}
}
Please find the corrected Json string
var searchresults = [
{
"providerlisting": [
{
"nametitle": "Cory M Spears, MD, FACP",
"caretype": "Internal Medicine",
"preferredProvider": true,
"address1": "289 N. Highland Ave.",
"address2": "",
"cityStateZip": "Atlanta, GA 30306",
"coverage": "/images/example.png",
"status": "Out of Network",
"psn": "",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere",
},
{
"nametitle": "Jimmy Dean, MD, FACP",
"caretype": "External Medicine",
"preferredProvider": false,
"address1": "3 Piedmont Rd.",
"address2": "",
"cityStateZip": "Atlanta, GA 30706",
"coverage": "/images/example2.png",
"status": "In Network",
"psn": "urlhere",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere",
},
{
"nametitle": "John Doe, DD, PM",
"caretype": "Internal Medicine",
"preferredProvider": true,
"address1": "500 Ponce De Leon Ave",
"address2": "Suite 5",
"cityStateZip": "Atlanta, GA 30706",
"coverage": "/images/example2.png",
"status": "Out of Network",
"psn": "urlhere",
"dcontact": "urlhere",
"save": "urlhere",
"rating": "urlhere",
}]
},
{
"categories": [{
"categoryMenu": [
{
"providertype": [
{
"title": "Doctor",
"link": "#doctor",
"amount": "400"
},
{
"title": "Hospital",
"link": "#hospital",
"amount": "40"
},
{
"title": "Urgent Care",
"link": "#urgentCare",
"amount": "37"
}
]
},
{
"specialty": [
{
"title": "Allergy and Immunology",
"link": "#allergyAndImmunology",
"amount": "2"
},
{
"title": "Audiology",
"link": "#audiology",
"amount": "3"
},
{
"title": "Allergy and Immunology",
"link": "#allergyAndImmunology",
"amount": "6"
},
{
"title": "Ambulatory Surgical Center",
"link": "#ambulatorySurgicalCenter",
"amount": "4"
}
]
},
{
"gender": [
{
"title": "Male",
"link": "#male",
"amount": "67"
},
{
"title": "Female",
"link": "#female",
"amount": "3"
}
]
}
]
}]
}];
alert(JSON.stringify(searchresults))

Categories