0

I want to extract Lat/Long values from the below mentioned array. Please help me.

var products = {"PolygonCords":"[[51.65040675460229,0.034332275390625],[51.613752957501,0.028839111328125],[51.61034179610213,0.1812744140625],[51.642737480428536,0.157928466796875]]"};
1
  • Thanks a lot for the solution. Thanks again Commented May 24, 2016 at 8:15

1 Answer 1

1

Parse the json string using JSON.parse() and iterate over array using forEach

var products = {
  "PolygonCords": "[[51.65040675460229,0.034332275390625],[51.613752957501,0.028839111328125],[51.61034179610213,0.1812744140625],[51.642737480428536,0.157928466796875]]"
};

JSON.parse(products.PolygonCords).forEach(function(v) {
  console.log(v[0], v[1])
})

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.