Skip to content

Instantly share code, notes, and snippets.

@gschanuel
Created April 26, 2022 15:09
Show Gist options
  • Save gschanuel/679702557d975f509163106be128cb92 to your computer and use it in GitHub Desktop.
Save gschanuel/679702557d975f509163106be128cb92 to your computer and use it in GitHub Desktop.
require 'json'
file = File.read('./event.json')
event = JSON.parse(file)
keys = event['windows']['perfmon']['metrics']
keys.each{|key,value|
hash = {}
if ( key =~ /_/ )
key.split('_').reduce(hash) { |h,m| h[m] = {} }
puts hash.to_json
end
}
#event['windows']['perfmon']['metrics'].store(hash.to_json, event['windows']['perfmon']['metrics'].delete(key))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment