Puppet Function: to_json
- Defined in:
- vendor_modules/stdlib/lib/puppet/functions/to_json.rb
- Function type:
- Ruby 4.x API
Summary
Convert a data structure and output to JSONOverview
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'vendor_modules/stdlib/lib/puppet/functions/to_json.rb', line 6 Puppet::Functions.create_function(:to_json) do # @param data # Data structure which needs to be converted into JSON # # @example Output JSON to a file # file { '/tmp/my.json': # ensure => file, # content => to_json($myhash), # } # # @return [String] Converted data to JSON dispatch :to_json do param 'Any', :data end def to_json(data) data.to_json end end |