javascript - Adding quotation mark in array values -


i have array of strings in object form received file, need add quotation mark around parameter names of objects strings inside array , around values between square brackets convert strings proper objects.

["{durdham hall electric: [e4.kwh]}", "{university hall substation: [e1.kwh]}",  "{university hall substation: [e2.kwh]}"] 

i have no idea how loop through values , add required symbol in required part.

maybe change

options.push('<option value="' + '{' + data[devices][1] + ': ' + '[' + 'e' + + '.kwh' + ']' + '}' + '" >' + metername + '</option>') 

to this, little nice parsable json

var data = [[0, 'durdham hall electric:']],      devices = 0,      metername = 'metername',      = 3,      options = [];    options.push('<option value="' + '{ \\"device\\": \\"' + data[devices][1] + '\\", \\"kwh\\": \\"' + 'e' + + '\\"}' + '">' + metername + '</option>');    alert(options);


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -