How to represent complex JSON BackEnd Response with nested arrays in Ember Model and Filter only certain element to appear in Template

Hi All, The below is the BackEnd Response with nested arrays and object , How Can filter two element from the below response and represent them in Ember Model and template .

I am Interested only to filter these two element (original & string ) from the below complete response : “input”:{
“original”:“Hello”, “reply”:{
“string”:“Hi!”,

The Complete Response : {
“ss_user”:[
{
“_id”:“59821c4a9e509e6e6f131943”, “id”:“user1”, “tenantId”:“master”, “__v”:0, “currentTopic”:“random”, “history”:[
{
“_id”:“59821c53f8849625c8d77e97”, “topic”:“random”, “reply”:{
“replyId”:“5981fb71f8849625c8d77e8a”, “replyIds”:[ ], “clearConversation”:false, “topicName”:“random”, “debug”:[ ], “string”:“Hi!”, “subReplies”:[ ], “stars”:[ ], “createdAt”:1501699155189 }, “input”:{
“original”:“Hello”, “clean”:“Hello”, “timestamp”:“2017-08-02T18:39:07.925Z” }, “stars”:[ ] } ], “pendingTopic”:null, “lastMessageSentAt”:“2017-08-02T18:39:15.030Z” } ] }

Thanks for your support.

Maha

This is done in the normalize() method of the serializer. I would suggest hanging on to _id, because you will need some form of primary key for Ember Data (which Model belongs to).

Hi Chris , Thanks for your quick Response , can you please explain in example as I am still new in Ember …

Currently I have the below :

1- routes/application.js import Ember from ‘ember’; export default Ember.Route.extend({ model: function() { return this.store.findAll(‘ssuser’); } });

2-models/'ssuser.js I am not sure what to write here : import DS from ‘ember-data’; export default DS.Model.extend({ ss_user: DS.attr() });

3-serializers/application.js I am not sure what to write here : import DS from ‘ember-data’; export default DS.RESTSerializer.extend({ primaryKey: ‘_id’, serializeId: function(id) { return id.toString(); } });

4-templates/application.js {{#each model as |item|}} {{item.history.input.original}} {{/each}}