Mercurial > repos > other > Puppet
view modules/stdlib/lib/puppet/functions/to_json.rb @ 275:d9352a684e62
Mass update of modules to remove deprecation warnings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 26 Jan 2020 11:36:07 +0000 |
parents | c42fb28cff86 |
children | adf6fe9bbc17 |
line wrap: on
line source
require 'json' # @summary # Convert a data structure and output to JSON # # @example how to output JSON # # output json to a file # file { '/tmp/my.json': # ensure => file, # content => to_json($myhash), # } # Puppet::Functions.create_function(:to_json) do # @param data # data structure which needs to be converted into JSON # @return converted data to json dispatch :to_json do param 'Any', :data end def to_json(data) data.to_json end end