item json sort by name
require 'json' file = open('item.json').read hash = JSON.parser.new(file).parse() item = hash['data'] sorted = item.sort_by {|key, val| val['name']} hash['data'] = sorted File.write 'item_sorted.json', hash.to_json