Observable not working

I having been using fetch to get data from a server but it has been working because the data return is having is a numeric array and not an array of a numeric array:

This Sample data return works perfectly when I use Each to display:

{ "responseData":
 [
	{ 
		"author": "Hermione Robinson"
	},
	{
		"author": "Herman Johnson"
	}
 ]
}

This Sample data return doesn’t when I use :

{ 
 [
	{ 
		"author": "Hermione Robinson"
	},
	{
		"author": "Herman Johnson"
	}
 ]
}

But the API am using returns data in the second format. I did a hack (var obj = { “model”: responseObject }:wink: for it to work. See the code below.

var Observable = require("FuseJS/Observable");
var data = Observable(); 
fetch(url)
.then(function(response) { return response.json(); })
.then(function(responseObject) { 
     var obj = { "model": responseObject };
data.value = obj; 
});

module.exports = {
   data: data,
};

My question:
What is the right way to implement the above fetch code without using the hack var obj = { “model”: responseObject }; ? I would love to use the data exactly the way it is return. When it is return this way the Observable doesn’t work.

I don’t think it’s a problem with Observable. Your second data sample is not valid JSON and will fail to parse. I don’t get how your hack will help on that. If that is the data you get in responseObject, you could just do data.value = responseObject[0]; to get to the array I guess.

Thanks a million.

This helps