I am having my table component in which i can populate data by Observable(where string is json object representing a row) or string[][] array.
I am getting the data from restful web service in observable format.
Which is the better approach and why?
Observables correspond to asynchronous data streams. It's something really powerful for asynchronous processing. Arrays correspond to the kind of data you can receive from HTTP calls for example. Observables allows to be notify when the response of an asynchronous processing is there. I simply the explanations but reactive programming allows to do much more...
In fact, it's something different. But observable isn't a format.
Let's take a sample with an HTTP call in Angular2:
this.http.get('http://...').subscribe(
response => {
// handle the received data
}
);
You can improve your processing chain with operators. For example to extract the JSON payload of the response:
this.http.get('http://...').map(response=>response.json()).subscribe(
data => {
// handle the received data
}
);
If you want to know more about reactive programming (observable is the core concept of this), you could have a look at this great tutorial: