1

Can anybody help?

Tab 1, chrome console, website: localhost:8080 (java application)

var test = {  
    rowAttrs: ["asdf","asdf"]
}
JSON.parse(JSON.stringify(test))

Result (unexpected):

Object {rowAttrs: "["asdf", "asdf"]"}

Tab 2, chrome console, website: any

var test = {  
    rowAttrs: ["asdf","asdf"]
}
JSON.parse(JSON.stringify(test))

Result (as expected):

Object {rowAttrs: Array[2]}
Sumama Waheed
  • 3,579
  • 3
  • 18
  • 32
  • 1
    They both mean the same thing. You can click on `Array[2]` and it will expand into `"["asdf", "asdf"]"`. – Rok Novosel Nov 23 '16 at 17:25
  • 1
    @RokNovosel: No, in the first one, `rowAttrs`'s value is a *string*. – T.J. Crowder Nov 23 '16 at 17:26
  • 4
    We can't answer this question with just the information shown. Apparently, something in the `localhost:8080` website is overwriting the `JSON.stringify` and/or `JSON.parse` function with something that misbehaves. We can't tell you what that is, though. – T.J. Crowder Nov 23 '16 at 17:27
  • 1
    thanks that was it, FYI http://stackoverflow.com/questions/710586/json-stringify-array-bizarreness-with-prototype-js – Sumama Waheed Nov 23 '16 at 17:30
  • @T.J.Crowder , can you put your comment as an answer? – Sumama Waheed Nov 23 '16 at 17:34
  • @SumamaWaheed: Wow! No need for an answer, you've found the question this duplicates. (Good find!) – T.J. Crowder Nov 23 '16 at 17:51

0 Answers0