0

I am trying to order and separate these arrays:

[1,"Av 6N entre Cl 49 y 48",3.4875177,-76.5258205,"P27D","Capri",1534954245000,1534953045000]
[1,"Av 6N entre Cl 49 y 48",3.4875177,-76.5258205,"P27D","Capri",1534953794000,1534953660000]
[1,"Av 7N con Cl 53AN",3.4873566,-76.529078,"A24","Altos de Menga",1534954085000,1534954085000]
[1,"Av 7N con Cl 53AN",3.4873566,-76.529078,"A24","Altos de Menga",1534955885000,1534955885000]
[1,"Av 6N con Cl 49 PP2",3.487253,-76.5255858,"P72","C. Empresa",1534954317000,1534954317000]
[1,"Av 6N con Cl 49 PP2",3.487253,-76.5255858,"P72","C.  

I want to order by the last date and separate with the first address, to have the format like this:

Av 6N entre Cl 49 y 48
[1,"Av 6N entre Cl 49 y 48",3.4875177,-76.5258205,"P27D","Capri",1534954245000,1534953045000]
[1,"Av 6N entre Cl 49 y 48",3.4875177,-76.5258205,"P27D","Capri",1534953794000,1534953660000]

Av 7N con Cl 53AN
[1,"Av 7N con Cl 53AN",3.4873566,-76.529078,"A24","Altos de Menga",1534954085000,1534954085000]
[1,"Av 7N con Cl 53AN",3.4873566,-76.529078,"A24","Altos de Menga",1534955885000,1534955885000]

Av 6N con Cl 49 PP2
[1,"Av 6N con Cl 49 PP2",3.487253,-76.5255858,"P72","C. Empresa",1534954317000,1534954317000]
[1,"Av 6N con Cl 49 PP2",3.487253,-76.5255858,"P72","C.

How do I do this?

  • Not able to understand how the expected output will look like – brk Aug 22 '18 at 16:14
  • This should be relatively straightforward with a loop, although note that your output format is invalid. The closest valid structure would be to have an object keyed by the second value of the array, which has a 2d array as its value. How do you access the arrays you have to begin with? Are they contained within another array? – Rory McCrossan Aug 22 '18 at 16:15

0 Answers0