Results 1 to 3 of 3

Thread: How to read nested data from JSON

  1. #1

    Default How to read nested data from JSON

    I have the following JSON response, I would like to read the "properties" data (r_creation_date, r_object_type, etc...)

    JSON:
    Code:
    {
        "id": "..",
        "title": "..",
        "links": [..],
        "entries": [{
            "id": "...",
            "title": "...",
            "updated": "..",
            "summary": {...},
            "content": {
                "name": "...",
                "type": "...",
                "definition": "...",
                "properties": {
                    "r_creation_date": "...",
                    "r_object_type": "...",
                    "int_attr_single": 1
                }, "links": [...]
            },
            "links": [...]
        }, {...}]
    }
    STORE:
    Code:
    Ext.define('Test_App.store.Personnel', {
        extend: 'Ext.data.Store',
        alias: 'store.personnel',
        fields: ['r_creation_date', 'r_object_type'],
        autoLoad: true,
        
        proxy: {
            type: 'rest',
            method: 'GET',
            url: '/app/store/UserInbox',
            format: 'json',
            headers: {
                'Accept': "application/json",
                'Content-Type': "application/json",
            },
                reader: {
                type: 'json',
                rootProperty: 'entries',
                record: 'content.properties'      //to use "renderer" remove this line
            }
        } 
    });
    VIEW:
    I tried the following

    Code:
    renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {                    
        return record.getData().content.properties.r_creation_date;
    }
    it is working with the Classic view and throwing error "Uncaught TypeError: Cannot read property 'getData' of null" in the Modern view.

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Duplicate: https://www.sencha.com/forum/showthread.php?328861

    Are you running 4.x or 6.x?

  3. #3

    Default

    6.x, so please ignore this post, I opened another post in 6.x section.

    Thanks

Similar Threads

  1. How can I read nested JSON objects.
    By jesus.valencia in forum Ext: Q&A
    Replies: 1
    Last Post: 24 Sep 2014, 5:38 PM
  2. Cannot read second value in nested json file
    By kuarama1990 in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 4 Oct 2012, 7:35 AM
  3. cant read nested json data
    By soniamru in forum Sencha Touch 2.x: Discussion
    Replies: 4
    Last Post: 11 Jun 2012, 11:50 PM
  4. How to read nested JSON in ExtJS?
    By thangamalar in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 30 Jun 2010, 7:32 AM
  5. Cannot read nested arrays inside JSON
    By olec in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 11 Apr 2010, 9:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •