简体   繁体   中英

How to retrive data using angular js and which stored json format in MYSQL coloumn

I have JSON data stored in MySQL column like this, column name is payments_json_details

[{"amount":"1000","mop":"Cash","paymentdate":"2017-12-04 16:25","remarks":"testt1"},{"amount":"2500","mop":"Cheque","paymentdate":"2017-12-05","remarks":"testt2"}] 

When we use this angular js for display purpose, iam getting data like above as it is., but i want to retrieve each values like amount, mop etc

{{pdata.deliveryinfo[index].payments_json_details}}

<span ng-repeat="(key, value) in pdata.deliveryinfo[index].payments_json_details">
        {{value}}
</span>

Iam tried this way, but there is no output, can anyone help?

JSON format like this

    {
        "jobcard_id": "33",
        "jobcard_sno": "8",
        "user_id": "140",
        "address_id": "22",
        "delivery_address_id": "22",
        "orderdetails": [{
            "id": "71",
            "jobcard_id": "33",
            "product_id": "462",
            "product_quantity": "2",
            "product_price": "324.00"
        }],
        "deliverydetails": [{
            "id": "4",
            "type": "Delivery Agent"
        }, {
            "id": "5",
            "type": "Delivery Agent"
        }],
        "deliveryinfo": [{
            "delivery_id": "7",
            "order_id": "33",
            "product_ids": "462",
            "payment_collected": "Partial",
            "payments_json_details": "[{\"amount\":\"1000\",\"mop\":\"Cash\",\"paymentdate\":\"2017-12-04 16:25\",\"remarks\":\"testt1\"},{\"amount\":\"2500\",\"mop\":\"Cheque\",\"paymentdate\":\"2017-12-05\",\"remarks\":\"testt2\"}]",
            "totaltime": "39:17:00"
        },{
            "delivery_id": "7",
            "order_id": "35",
            "product_ids": "485",
            "payment_collected": "Partial",
            "payments_json_details": "[{\"amount\":\"5000\",\"mop\":\"Cash\",\"paymentdate\":\"2017-12-04 16:25\",\"remarks\":\"testt1\"},{\"amount\":\"7000\",\"mop\":\"Cheque\",\"paymentdate\":\"2017-12-05\",\"remarks\":\"testt2\"}]",
            "totaltime": "39:17:00"
}],
        "$$hashKey": "testt"
    }

I am considering pdata.deliveryinfo is an array containing JSON objects. If its pdata.deliveryinfo[index].payments_json_details then use it in ng-repeat .

<span ng-repeat="data in pdata.deliveryinfo>
   Amount: {{data.amount}}, MOP : {{data.mop}}, Payment Date : {{data.paymentdate}}, Remarks : {{data.remarks}}
</span>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM