Chanafot
Chanafot

Reputation: 796

jfrog artifactory "invalid character '"' after object key:value pair"

So I have this spec file in artifactory to remove folders (with artifacts inside) older than 3 months in more than one repository (3 in this example).

{
    "files": [{
        "aql": {
            "items.find": {
                "$or": [{
                    "$and": [{
                        "repo": "repo1",
                        "path": "com/domain/repo1",
                        "created": {
                            "$before": "3mo"
                        }
                        "type": "folder",
                        "name": {"$match":"20*"}
                    }],
                    "$and": [{
                        "repo": "repo2",
                        "path": "com/domain/repo2",
                        "created": {
                            "$before": "3mo"
                        }
                        "type": "folder",
                        "name": {"$match":"20*"}
                    }],
                    "$and": [{
                        "repo": "repo3",
                        "path": "com/domain/repo3",
                        "created": {
                            "$before": "3mo"
                        }
                        "type": "folder",
                        "name": {"$match":"20*"}                    
                    }]
                }]
            }
        }
    }]
}

But I´m getting: [Error] invalid character '"' after object key:value pair

How can I tell what is the (") that is causing the error? is not quite descriptive the output like in some other languajes that tells you the line number at least.

On the other hand, if I use following spec for a single repository, it works like a charm. thank you!

{
"files": [{
    "aql": {
        "items.find": {
            "repo": "repo5",
            "path": "com/domain/repo5",
            "created": {
                 "$before": "3mo"
            },
            "type":"folder",
            "name": {"$match":"20*"}
        }
    }
}]}

Upvotes: 0

Views: 7550

Answers (1)

Dror Bereznitsky
Dror Bereznitsky

Reputation: 20376

You are missing a comma after all of the "created" key/value pairs:

"created": {
   "$before": "3mo"
} <-- missing a comma here
"type": "folder",

Please notice that your working example has the comma in the right place.

Upvotes: 2

Related Questions