0
{
    "statusCode": "000",
    "statusMessage": "Record Successfully Fetched",
    "dsStatusCode": "000",
    "dsStatusMessage": "Record Successfully Fetched",
    "businessInput": null,
    "businessOutput": {
        "systemCircleId": "2",
        "category": [
            {
                "categoryId": "abcs",
                "sys": "5ID",
                "displayName": "National Roaming Recharge",
                "packsList": [
                    {
                        "amount": "79",
                        "benefits": "dsdsdsds",
                        "packId": "1344",
                        "processingFees": "70.3",
                        "serviceTax": "8.7",
                        "validity": "30 Days",
                        "volume": "0.0",
                        "isTop5": "no",
                        "fileName": "null"
                    },
                    {
                        "amount": "188",
                        "benefits": "Roaming Tariff - Incoming Free, Outgoing local @ 80p/min, STD @1.15Rs/min with Talk Time 120 in main A/c",
                        "packId": "1263",
                        "fess": "47.3",
                        "serviceTax": "20.7",
                        "validity": "28 Days",
                        "volume": "0.0",
                        "isTop5": "no",
                        "fileName": "null"
                    },
                    {
                        "amount": "306",
                        "benefits": "FTT 306 with Roaming Tariff - Incoming Free, Outgoing local @ 80p/min, STD @1.15Rs/min",
                        "packId": "1290",
                        "processingFees": "0",
                        "serviceTax": "33.7",
                        "validity": "28 Days",
                        "volume": "0.0",
                        "isTop5": "no",
                        "fileName": "null"
                    }
                ]
            }
        ]
    }
}

I want to parse this json to filter packlist for each category id using angularjs

8
  • So, what have you tried yourself and where does it go wrong? Commented Jun 2, 2015 at 10:40
  • It's already JSON, So what do you want/ Commented Jun 2, 2015 at 10:40
  • not able to use ng-repeat within ng-repeat <div ng-app="myForm" ng-controller="myController" > {{businessOutput}} <p ng-repeat="main in mains"> <p ng-repeat="submain in main.businessOutput"> {{submain.category.categoryId}} </p> </p> </div> Commented Jun 2, 2015 at 10:41
  • {{submain.category[0].categoryId}} as category is an array thus you need to use indexer Commented Jun 2, 2015 at 10:42
  • 1
    Don't just past the code. Clearly define the problem Commented Jun 2, 2015 at 10:48

1 Answer 1

0

assign a variable to the JSON you have. and use scope.$eval on the variable

Example

var jsonVar = { "statusCode": "000",
    "statusMessage": "Record Successfully Fetched",
    "dsStatusCode": "000",
    "dsStatusMessage": "Record Successfully Fetched",
    "businessInput": null
    }

scope.$eval(jsonVar) // this gives the object on which you can do the ng-repeat

if you still have problems. Try using JSON.stringify(jsonVar) and then perform a scope.$eval on the this.

var jsonString = JSON.stringify(jsonVar);
scope.$eval(jsonString);// This returns a object too
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.