I am trying to refference certain items in the API but uglify and even my text editor are fighting me. For example:
post._embedded.author[0].avatar_urls.96
causes uglify to throw an error (probably because of the number). Here is another example:
post._embeded.wp:featuredmedia[0].media_details.sizes.full.source_url
Also causes issues for me (because of the colon).
How can I overcome this? Here is the full object I am trying to build:
var postObject = {
id: post.id,
link: post.link,
title: post.title.rendered,
author: post._embedded.author[0].name,
authorImage: post._embedded.author[0].avatar_urls .96,
excerpt: post.excerpt.rendered,
categories: post.categories, //add array of categories[]
featuredImage: post._embedded.wp:featuredmedia[0].media_details.sizes.full.source_url
};
I sorted this one out!
post._embedded['wp:featuredmedia'][0].media_details.sizes.full.source_url
I was unaware of the bracket notations!