如何迭代json对象?

时间:2019-02-27 11:40:57

标签: html angular

我从外部APIexternal API)获得以下值。我认为这是JSON对象。如何以角度打印此值?

    {
    "job_details": {
        "job_title": "Cook",
        "company_email": "suryaadisiva@gmail.com",
        "industry": "Advertisement",
        "phone_no": "9746448899",
        "days_to_join_id": "2",
        "days_to_join": "Within a week",
        "participatestatus": "0",
        "job_type_name": "Full Time",
        "Qualficationprofileflag": "1",
        "jobview_count": "1",
        "company_id": "440",
        "job_add_date": "2019-02-26 09:33:36",
        "minimum_qual": "10th/SSLC",
        "Skills": "Chinese",
        "jobgender": "Female",
        "date_diff": 1,
        "experience": "2 - 3 years",
        "salary": "Rs 10,000 - 15,000"
         },
    "jobtoshowflag": "1",
    "jobdeleted": 0
}

以上是来自外部API的格式。什么是用html语法将其打印成角形?

1 个答案:

答案 0 :(得分:0)

将回复保存为variabledata

data = {
    "job_details": {
        "job_title": "Cook",
        "company_email": "suryaadisiva@gmail.com",
        "industry": "Advertisement",
        "phone_no": "9746448899",
        "days_to_join_id": "2",
        "days_to_join": "Within a week",
        "participatestatus": "0",
        "job_type_name": "Full Time",
        "Qualficationprofileflag": "1",
        "jobview_count": "1",
        "company_id": "440",
        "job_add_date": "2019-02-26 09:33:36",
        "minimum_qual": "10th/SSLC",
        "Skills": "Chinese",
        "jobgender": "Female",
        "date_diff": 1,
        "experience": "2 - 3 years",
        "salary": "Rs 10,000 - 15,000"
         },
    "jobtoshowflag": "1",
    "jobdeleted": 0
    }

HTML

<h1>{{data.jobtoshowflag}}</h1>
<h1>{{data.job_details.job_title}}</h1>