Estos son números aleatorios para la privacidad.
Deben dividirse por la coma y colocarse en sus propias constantes
{ '0': '2', '1': '5', '2': '.', '3': '1', '4': '3', '5': '4', '6': '2', '7': '0', '8': '0', '9': ',', '10': ' ', '11': '-', '12': '3', '13': '8', '14': '.', '15': '5', '16': '4', '17': '9', '18': '2', '19': '0', '20': '2' }Puede usar Object.values para obtener una matriz, luego unirla y dividirla por coma. Finalmente, convierta las partes divididas en número:
const data = {'0': '2','1': '5','2': '.','3': '1','4': '3','5': '4','6': '2','7': '0','8': '0','9': ',','10': ' ','11': '-','12': '3','13': '8','14': '.','15': '5','16': '4','17': '9','18': '2','19': '0','20': '2'}; const [long, lat] = Object.values(data).join("").split(",").map(Number); console.log(long, lat);Iba a sugerir lo siguiente, pero la respuesta de Trincot es mucho mejor.
const data = {'0': '2','1': '5','2': '.','3': '1','4': '3','5': '4','6': '2','7': '0','8': '0','9': ',','10': ' ','11': '-','12': '3','13': '8','14': '.','15': '5','16': '4','17': '9','18': '2','19': '0','20': '2'}; const convertArrayItemsToInt = (digist_array) => { return parseFloat( digist_array.reduce((complete_number, currentDigit) => { if (!isNaN(parseInt(currentDigit)) || currentDigit == ".") { complete_number += currentDigit; } return complete_number; }, "") ); }; //Get only the values const coordinates = Object.values(data); //Get the comma index const comma_index = coordinates.indexOf(","); //Split the array by the comma and give it to convertArrayItemsToInt const lat = convertArrayItemsToInt(coordinates.slice(0, comma_index)); const lng = convertArrayItemsToInt( coordinates.slice(comma_index, coordinates.length) );