javascript - Iterate Json ResponseText in Coffeescript -
my coffeescript
errorlist = @state.errors.responsetext own key, value of errorlist console.log "#{key} -> #{value}"
my errorlist variable={"link":["is invalid"]}
when run code, in output iterate each char in errorlist. how can "link -> invalid" ?
it seems responsetext property string, isn't yet iterable object. convert (valid) json string object can iterate, should call json.parse.
the following should work in case
errorlist = json.parse @state.errors.responsetext own key, value of errorlist console.log "#{key} -> #{value}"
output:
link -> invalid
Comments
Post a Comment