#! /usr/bin/ruby # # json_ruby_update.rb # # Jun/10/2011 # require "cgi" require "json" # load '/var/www/data_base/common/ruby_common/cgi_manipulate.rb' load '/var/www/data_base/common/ruby_common/text_manipulate.rb' load '/var/www/data_base/common/ruby_common/file_io.rb' # --------------------------------------------------------------------- print "Content-type: text/html\n\n" # print "*** json_ruby_update.rb ****
" hhh = parse_parameter() # print "*** aaa ***

" json_file = "/var/tmp/json/cities.json" # print "*** bbb ***

" json_str = read_string_proc(json_file) print "*** ccc ***

" # dict_aa=JSON.parse(json_str) print "*** ddd ***

" # # hhh.each do |unit| id = unit["id"] population=unit["population"].to_i print "*** ddd ***

" dict_aa=dict_update_proc(dict_aa,id,population) print "*** eee ***

" end print "*** fff ***

" # json_out = JSON.pretty_generate(dict_aa) file_write_proc(json_file,json_out) # print "*** end ***

"