Ted, this is awesome and really should make it into the main trunk.
Having JSON support would rock.  YAML would also rock.  Both data formats
are used all over the place, and we would have a ton of use cases for this.

Please target this for inclusion in the next version of the community
version.





On 9/21/12 5:55 AM, "Ted Zlatanov" <t...@lifelogs.com> wrote:

>You can find some experimental support for JSON in my fork of the core
>CFEngine here:
>
>https://github.com/tzz/core/tree/feature/json
>
>This is rough undocumented code intended as a proof of concept, written
>in my spare time.  It's not officially supported by CFEngine!
>
>It provides three things (the path is an array like ["x", 0] to denote
>key "x" and array index 0):
>
>1)
>
>"varname" string => readjsonstring("JSON data", "JSON path", maxlength);
>
>2) 
>
># returns array values or object elements
>"listvar" slist => readjsonslist("JSON data", "JSON path", maxitems);
>
># return array indices or object keys
>"listvar" slist => readjsonkeys("JSON data", "JSON path", maxitems);
>
>3) various booleans that return a class, all taking ("JSON data", "JSON
>path") parameters:
>
>isjsonexists
>isjsonfalse
>isjsontrue
>isjsonprimitive
>isjsoncontainer
>isjsonarray
>isjsonobject
>
>There are acceptance tests in
>tests/acceptance/01_vars/02_functions/08[1-3].cf which show the usage of
>these functions clearly.
>
>I need your comments please:
>
>- is this something you've been looking for?
>
>- should I consolidate the booleans into a single function that takes a
>  string parameter to denote the test?
>
>- do the functions work like you'd expect?  How would you change them?
>
>I look forward to your comments!
>
>Ted
>_______________________________________________
>Help-cfengine mailing list
>Help-cfengine@cfengine.org
>https://cfengine.org/mailman/listinfo/help-cfengine

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to