fork(2) download
  1. # -*- encoding: UTF-8 -*-
  2. require 'json'
  3.  
  4. # data : どこぞから受け取る文字列(中身はJson_string風文字列)データ
  5. data=[{"a": 1,"b": 1,"c": 88},{"a": 1,"b": 2,"c": 82},{"a": 1,"b": 3,"c": 79}]
  6.  
  7. p data.class
  8.  
  9. #aj=Array[data]
  10. #puts aj
  11.  
  12. #aj=JSON[aj]
  13.  
  14. #p aj
  15. #p aj.class
  16.  
  17. # 最終的には各keyとvalueを取得したい
  18. #aj.each do |m|
  19. # p m["a"]
  20. # p m["b"]
  21. # p m["c"]
  22. #end
  23.  
  24. #JSON("[" + data + "]").each{|h| h.each{|k, v| puts "#{k}: #{v}" }}
  25. JSON(data).each{|h| h.each{|k, v| puts "#{k}: #{v}" }}
  26.  
  27.  
Runtime error #stdin #stdout #stderr 0.01s 7404KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.rb:5: syntax error, unexpected ':', expecting tASSOC
data=[{"a": 1,"b": 1,"c": 88},{"a": 1,"b...
           ^