parsejson

Table of Contents

Prototype: parsejson(json_data)

Return type: data

Description: Parses JSON data directly from an inlined string and returns the result as a data variable

Arguments:

  • json_data: string, in the range: .*

Please note that because JSON uses double quotes, it's usually most convenient to use single quotes for the string (CFEngine allows both types of quotes around a string).

Example:

    vars:

      "loadthis"

         data =>  parsejson('{ "key": "value" }');

See also: readjson(), mergedata(), and data documentation.