Search Results

Search found 1 results on 1 pages for 'user3614570'.

Page 1/1 | 1 

  • JSON element detection

    - by user3614570
    I’ve created a string… {"atts": [{"name": "wedw"}, {"type": "---"}]} I pile a bunch of these together in an array based on user input and attach them to another string to complete a JSON object that tests out as valid. So I end up with a global array called fields with a bunch of these little snippets. So how do I change the name "weds" with a new name? I’ve tried... function changefieldname(pos){ var obj = JSON.parse(jsonstring); var oldname = obj.tracelog.fields[pos].atts[0]["name"]; var newname = document.getElementById("newlogfieldname"+pos).value; fields[pos].replace(oldname, newname); //writejson(); } And a bunch of variations. I know everything is checking out correct interms of the variables pos, oldname, and newname. I also know that fields[pos] returns the string in the array I want to correct but it’s not happy. I also tried converting fields[pos] to a string, but the replace function doesn't work on it. I’m sure there is a good reason.

    Read the article

1