I've got some JSON that looks like this:
[
{
_id: ObjectId("544809736654daf1ea897ca"),
project: "demo",
tools: ['ajax', 'javascript', 'html'],
},
{
_id: ObjectId("322148965654daf1ea81ca"),
project: "trial",
tools: ['haskell'],
}
]
I've saved it in a file called items.
I'm trying to import it to my Angular project with this code:
app.service("getItemsService",
function($http, $q){
return {
getItems: function getItems(){
return $http.get('data/_items').success(function(data){
return data;
});
}
}
}
);
but when I do, I get an error saying:
SyntaxError: Unexpected token _
at Object.parse (native)
I've tried everything I can think of to fix this - i.e. I've named the file items.json, I changed _id to id, I've tried adding {'Content-Type': 'application/json'} to get() function as a parameter to indicate its JSON.
Nothing is working! Any tips?

'data/_items'as the get method looks a little goofy to me. What are you doing with the returned data, where is the error happening?