3 Replies Latest reply on Mar 31, 2016 6:24 AM by adityaku RSS
    adityaku Apprentice

    how to take out the length of the json elements?

    for example:

     

    var text =

    {"employees":[

        {"firstName":"John", "lastName":"Doe", "Age":"24", "Gender":"M"},

        {"firstName":"Anna", "lastName":"Smith", "Age":"25", "Gender":"F"},

        {"firstName":"Peter", "lastName":"Jones", "Age":"24", "Gender":"M"},

        {"firstName":"Aditya", "lastName":"Kumar", "Age":"25", "Gender":"M"},

        {"firstName":"Shashank", "lastName":"Rai", "Age":"24", "Gender":"M"},

        {"firstName":"Harshit", "lastName":"Chowdhary", "Age":"24", "Gender":"M"},

        {"firstName":"Reetam", "lastName":"Kansabanik", "Age":"26", "Gender":"M"},

        {"firstName":"Priyanka", "lastName":"Kumari", "Age":"20", "Gender":"F"},

        {"firstName":"Nidhi", "lastName":"Tiwari", "Age":"22", "Gender":"F"},

        {"firstName":"Priyanshu", "lastName":"Mehta", "Age":"23", "Gender":"M"},

        {"firstName":"Preeti", "lastName":"Gupta", "Age":"24", "Gender":"F"},

        {"firstName":"Virat", "lastName":"Kohli", "Age":"28", "Gender":"M"},

        {"firstName":"Mahendra", "lastName":"Dhoni", "Age":"24", "Gender":"M"},

        {"firstName":"Harshita", "lastName":"Rai", "Age":"23", "Gender":"F"},

        {"firstName":"Ishan", "lastName":"Verma", "Age":"24", "Gender":"M"},

        {"firstName":"Moen", "lastName":"Ali", "Age":"24", "Gender":"M"},

        {"firstName":"Muktesh", "lastName":"Chandra", "Age":"32", "Gender":"M"},

        {"firstName":"Vinod", "lastName":"Patel", "Age":"28", "Gender":"M"}

    ]}

     

     

    In the above example we have 18 elements, but how take the length of var text in case of JSON elements in thingworx?