0

I want the total number of lines of an object file. How is this possible?

let count = Object.keys(obj).length With this I can get the key wise value but it will not give the sub key like "products"

In this example total number of lines is 22

{
"device-native-resolution": "1920x1080",
"discount": 
 {
   "amount": "52.00",
   "applicable": true
},
"email": "ddeech8e@gmail.com",
"order_id": 4248349409343,
"previous-vists": 3,
"products": 
[
   {
      "gift_card": false,
      "line_price": "0.00",
      "name": "Totebag",
      "price": "0.00",
      "product_id": 4567,
      "quantity": 1
    }
]
}
mplungjan
  • 169,008
  • 28
  • 173
  • 236

0 Answers0