How to use clasp run with properties - the valid JSON format

557 Views Asked by At

Why does this clasp command no longer work for me?

clasp run setProperty -p ['domain' 'mydomain.com']

which runs this function

function setProperty(key,value) {
    let scriptProperties = PropertiesService.getScriptProperties()
    scriptProperties.setProperty(key,value)
};
PC:AppsScript-CLASP user$ clasp run setProperty -p ['domain' 'mydomain.com']
Input params not Valid JSON string. Please fix and try again

Is this an issue with my system or the packages?

I'm using

  • Node v8.11.1
  • Clasp v2.3.0
  • MacOs BigSur v11.2.1
1

There are 1 best solutions below

1
On BEST ANSWER

You forgot a comma and single quotes

As per the example in the documentation you must use single quotes outside the array and double quotes when using a string clasp run 'setProperty' -p '["domain", "mydomain.com"]'.

Reference