How js converts an array of strings to an array of js

[{latitude:, longitude:, proname: Liancheng Guanyang Mountain 5A Tourism area Project}]

how to convert the above string into an js array object so that the elements in the array can be transformed into objects that can be valued

it is not possible to cast with eval

Nov.23,2021

what is this string
:, what format is this

your format needs to be corrected
JSON.parse cannot be because the JSON.parse conversion key value must be in double quotes, including specific query documents
what string substitution removal is possible, but access is also not accessible


use the replace () and splite () methods


to post the results you want. What array do you want?


do not use eval
use JSON.parse


there is something wrong with the part you posted, it should be in this format, [{name: "a"}, {name: "b"},.], which can generally be converted with JSON.parse ()


.

convert first to legal json format string, and then to js array

if you want to transfer this string, you can write

like this.
const str = '[{latitudes:123, longitude:, proname:5A }]'
const jsonStr = str.replace(
  /"?((?:(?!\{).)+?)"?:"?((?:(?![\}|,|"]).)*)"?([,|\}])/g,
  (_, b, c, d) => {
    return `"${b.trim()}":"${c.trim()}"${d}`
  },
)
const arr = JSON.parse(jsonStr)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bd7406-3106d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bd7406-3106d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?