From: 7stud -- Date: 2011-04-26T09:46:58+09:00 Subject: Re: How to split dot “.” only before equal “=” 7stud -- wrote in post #994963: > ...and you can even get rid of that ugly if check every time through the loop: str = 'projects.risks.Index.flash_downloading=Downloading.test' key_str, val = str.split('=') keys = key_str.split(/[.]/) temp = master = {} last = keys.pop keys.each do |key| temp = temp[key] = {} end temp[last] = val p master --output:-- {"projects"=>{"risks"=>{"Index"=>{"flash_downloading"=>"Downloading.test"}}}} -- Posted via http://www.ruby-forum.com/.