Reputation: 8509
Hello i have built a web application along with a mobile app, my application has several APIs that return JSON data. I am currently working with another developer who wants to use that data. This is a sample of the data:
{
"categories": [
{
"id": 6,
"name": "Gospel",
"thumbs": [
"http://xxxxxxxxxx.com/_uploads/2015-12-09/LHmKGd9nzrP7PB6X/gospel-300x250.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/LHmKGd9nzrP7PB6X/gospel-150x125.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/LHmKGd9nzrP7PB6X/gospel-75x62.jpg"
],
"slug": "gospel",
"event_count": 0
},
{
"id": 7,
"name": "Musicals",
"thumbs": [
"http://xxxxxxxxxx.com/_uploads/2015-12-09/wTLvRXZeWSV5PVWZ/musicals-300x250.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/wTLvRXZeWSV5PVWZ/musicals-150x125.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/wTLvRXZeWSV5PVWZ/musicals-75x62.jpg"
],
"slug": "musicals",
"event_count": 0
},
{
"id": 8,
"name": "Comedy",
"thumbs": [
"http://xxxxxxxxxx.com/_uploads/2015-12-09/Ji95h2RowbxMf3QZ/comedy-300x250.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/Ji95h2RowbxMf3QZ/comedy-150x125.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/Ji95h2RowbxMf3QZ/comedy-75x62.jpg"
],
"slug": "comedy",
"event_count": 0
},
{
"id": 9,
"name": "Drama And Theatre",
"thumbs": [
"http://xxxxxxxxxx.com/_uploads/2015-12-09/HQ9c76O9kxQ3qVjq/drama-and-theatre-300x250.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/HQ9c76O9kxQ3qVjq/drama-and-theatre-150x125.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/HQ9c76O9kxQ3qVjq/drama-and-theatre-75x62.jpg"
],
"slug": "drama-and-theater",
"event_count": 0
},
{
"id": 10,
"name": "Tours",
"thumbs": [
"http://xxxxxxxxxx.com/_uploads/2015-12-09/K6m4kRnEmMS927Sd/tours-300x250.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/K6m4kRnEmMS927Sd/tours-150x125.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/K6m4kRnEmMS927Sd/tours-75x62.jpg"
],
"slug": "tours",
"event_count": 1,
"events": [
{
"id": 6,
"category_id": 10
}
]
},
{
"id": 11,
"name": "Sports",
"thumbs": [
"http://xxxxxxxxxx.com/_uploads/2015-12-09/Qg8d5Xy5ySr3BOSZ/sports-300x250.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/Qg8d5Xy5ySr3BOSZ/sports-150x125.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/Qg8d5Xy5ySr3BOSZ/sports-75x62.jpg"
],
"slug": "sports",
"event_count": 0,
"events": []
},
{
"id": 12,
"name": "Cinema",
"thumbs": [
"http://xxxxxxxxxx.com/_uploads/2015-12-09/zkKPVrBjiryUKSKF/cinema-300x250.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/zkKPVrBjiryUKSKF/cinema-150x125.jpg",
"http://xxxxxxxxxx.com/_uploads/2015-12-09/zkKPVrBjiryUKSKF/cinema-75x62.jpg"
],
"slug": "cinema",
"event_count": 0
}
]
}
Now according to him this data is too complex and has to be parsed several times on his end, he uses ruby. However this is not the case for me in both PHP and Javascript. I use both laravel and AngularJS. I have run this JSON through a validity checker and it is indeed valid. I would like some information on this now, are there any issues with this JSON, can it be made simpler in any way?
Upvotes: 0
Views: 126
Reputation: 1287
No, JSON is a relatively simple data structure. Behind the scenes it is the same data structure as YAML for instance, only with a different syntax. It is any combination of name-value pairs and arrays, of which any element itself can be part of a name-value pair or array. Simple.
The other developer has two options:
It seems likely that only the first option is viable. Perhaps he should be posting his problems on here?
Upvotes: 2