A
A
Adel1ne2016-06-29 12:03:28
ExtJS/Sencha
Adel1ne, 2016-06-29 12:03:28

How to convert json structure for Ext.data.Model?

Hello! I started to study ExtJS and ran into a problem:
There is a json response of the form:

"users": {
    "1": [
      {
        "id": 1,
        "login": "user1",
        "password": "12345",
      }
    ],
   "2": [
      {
        "id": 2,
        "login": "user2",
        "password": "123456",
      }
    ]
  }

The Ext.data.Model object is created like this:
Ext.define('User', {
           extend: 'Ext.data.Model',
                     
            idProperty: 'id',
                     
            fields: [{
                name: 'id,
                type: 'int'
            }, {
                name: 'login',
                type: 'string'
            }, {
                name: 'password',
                type: 'string'
            }]
      });

How to convert json request to Ext.data.Model or vice versa? Any option will suit me :)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question