I have a string im working with from the JSON data below:
You will notice the name of the companies is stored in a string:
ie:
"content": {
"type": "text",
"$t": "name: ANGLO AMERICAN, price: 1547, change: 8.5"
My problem is i want to pull out just the names of the companies. Currently i only have the string:"name: ANGLO AMERICAN, price: 1547, change: 8.5"
getting there is in the code below :
$(function() {
$.getJSON("https://spreadsheets.google.com/feeds/list/0AhySzEddwIC1dEtpWF9hQUhCWURZNEViUmpUeVgwdGc/1/public/basic?alt=json", function(data) {
console.log(data.feed.entry[0].content.$t);
var foo = JSON.parse(data.feed.entry[0].content.$t);
console.log(foo);
});
});
however i was hoping to turn the string into a set of objects like:
"name": "ANGLO AMERICAN",
"price": 1547,
"change": 8.5
Any advice on how to do this? or at least how to seperate the name from the string (keep in mind this is one in an array so the solution needs to work on all names in the data).
Thanks, Ewan