Skip to content

fnJq regression  #113

@hmarko

Description

@hmarko

Hi there Mr Guy!

I think something changed from previous versions.

This used to work:

  • type: expression
    name: flat_service_info
    expression: "fn.fnJq($(settings),'.|[leaf_paths as $path|{key: $path|join("^"), value: getpath($path)}]')"
    hide: true
    noOutput: true

It’s working using jq CLI :

[root@centos1 forms]# cat /tmp/a.json | jq '.| [leaf_paths as $path | {"key": $path | join("^"), "value": getpath($path)}]'
[
{
"key": "Home Dir^koko^yoyo^jojo^prod^cifsaccess^ntfs_acls^acls^0^access",
"value": "modify"
},

AF log entry returns this:

2023-11-19 10:09:42:942 error: Error in fnJq : jq: error: leaf_paths/0 is not defined at , line 1:
def fn2KB: ./1024;def fn2MB: ./1024/1024;def fn2GB: ./1024/1024/1024;def fnRound0: .*1.0 + 0.5|floor/1.0;def fnRound1: .*10.0 + 0.5|floor/10.0;def fnRound2: .*100.0 + 0.5|floor/100.0;def fnRound: .*100.0 + 0.5|floor/100.0;.services|[leaf_paths as $path|{key: $path|join("^"), value: getpath($path)}]

for testing purposes, it should work on any JSON input

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions