Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49173

How to query critical JSON into ionic

$
0
0

@shivsuthanm wrote:

Hi,

I received the JSON response from the server mentioned below.

{
  "employeeId": null,
  "id": "DB06442E-2993-4FE8-B496-5A0CF61C8342",
  "message": null,
  "objects": [
    {
      "Children": [],
      "Fields": [
        {
          "Key": "CallID",
          "Value": 1000
        },
        {
          "Key": "CallDate",
          "Value": "Sep 9 2016 10:14AM"
        },
        {
          "Key": "ClientName",
          "Value": ""
        },
        {
          "Key": "AssetName",
          "Value": "Automatic Cold Cranking Simulator"
        },
        {
          "Key": "CallCategory",
          "Value": "Corrective Maintenance"
        }
      ],
      "Type": 8
    },
    {
      "Children": [],
      "Fields": [
        {
          "Key": "CallID",
          "Value": 1000
        },
        {
          "Key": "CallDate",
          "Value": "Sep 9 2016 10:20AM"
        },
        {
          "Key": "ClientName",
          "Value": ""
        },
        {
          "Key": "AssetName",
          "Value": "Auto Mini Pour Point Tester "
        },
        {
          "Key": "CallCategory",
          "Value": "Preventive Maintenance"
        }
      ],
      "Type": 8
    },
    {
      "Children": [],
      "Fields": [
        {
          "Key": "CallID",
          "Value": 1000
        },
        {
          "Key": "CallDate",
          "Value": "Sep 9 2016 10:23AM"
        },
        {
          "Key": "ClientName",
          "Value": ""
        },
        {
          "Key": "AssetName",
          "Value": "Balance - Citizon CX 220"
        },
        {
          "Key": "CallCategory",
          "Value": "Calibration"
        }
      ],
      "Type": 8
    },
    {
      "Children": [],
      "Fields": [
        {
          "Key": "CallID",
          "Value": 1001
        },
        {
          "Key": "CallDate",
          "Value": "Sep 9 2016 10:26AM"
        },
        {
          "Key": "ClientName",
          "Value": ""
        },
        {
          "Key": "AssetName",
          "Value": "Others"
        },
        {
          "Key": "CallCategory",
          "Value": "Installation"
        }
      ],
      "Type": 8
    }
  ],
  "success": true
}

In this, I need to populate ion-items for each Fields like below:

"Fields": [
            {
              "Key": "CallID",
              "Value": 1001
            },
            {
              "Key": "CallDate",
              "Value": "Sep 9 2016 10:26AM"
            },
            {
              "Key": "ClientName",
              "Value": ""
            },
            {
              "Key": "AssetName",
              "Value": "Others"
            },
            {
              "Key": "CallCategory",
              "Value": "Installation"
            }
          ]

How to manage this. Pls find the below code.

$http.post("http://crm.test.com/GetAllObjects",
                                {"objectId":null,"objects":null,"searchParams":null,"sessionId":"DB06442E-2993-4FE8-B496-5A0CF61C8342","type":8})
                     .success(function(data) {
                              alert("SUCCESS!");
                              console.log(data);
                              })
                     .error(function(data) {
                            alert("ERROR");
                            alert(data);
                            });

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49173

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>