Parsing WordPress API JSON with AngularJS

i have following output from WordPress API JSON and want to parse it with AngularJS:

    attachments: [
{
id: 241740,
url: "url/1.jpg",
slug: "slug-from-title",
title: "Slug from Title",
description: "",
caption: "",
parent: 241738,
mime_type: "image/jpeg",
images: {
full: {
    url: "url/1.jpg",
    width: 770,
    height: 400
    },
thumbnail: {
    url: "url/1-150x150.jpg",
    width: 150,
    height: 150
    },
    medium: {
    url: "url/1-300x156.jpg",
    width: 300,
    height: 156
    },
post-thumbnail: {
    url: "url/1-615x400.jpg",
    width: 615,
    height: 400
    }
}
}
],
thumbnail_images: {
full: {
url: "url/1.jpg",
width: 770,
height: 400
},
thumbnail: {
url: "url/1-150x150.jpg",
width: 150,
height: 150
},
medium: {
url: "url/1-300x156.jpg",
width: 300,
height: 156
},
post-thumbnail: {
url: "url/1-615x400.jpg",
width: 615,
height: 400
},

If i try to parse it in Phonegap with AngularJS and take:

post.attachments[0].images.thumbnail.url

it returns the URL i need, but:

post.thumbnail_images.medium-thumb.url

returns nothing.

Does anyone have an idea?


Source: wordpress

Leave a Reply