How to iterate through JSON hash with coffeescript

后端 未结 2 1887
有刺的猬
有刺的猬 2021-02-18 23:35

I\'m new to Coffeescript and I\'m having issues resolving an issue. I have a JSON object that is currently stored in a variable. How do I iterate through the keys in the JSON ob

相关标签:
2条回答
  • 2021-02-19 00:13
    for key, value of result
      console.log "#{key} and #{value}"
    

    more in the docs#loops

    0 讨论(0)
  • 2021-02-19 00:20
    result = JSON.parse client
         for c in result
            console.log(c.key +"-"+ c.value)
    

    it's work!

    0 讨论(0)
提交回复
热议问题