Formatting of RPC parameters in VSCode command

  1. My goal is: I’m trying to use VSCode to send an RPC command over UART including parameters as a JSON string.

  2. My actions are: In the VSCode mos command window, I enter a mos command:
    mos call checkFirmware '{"childPeriod":10}'

  3. The result I see is: an error:

Args [’{“childPeriod”:10}’] is not a valid JSON string

If I paste exactly the same command into Terminal on the same (Mac) machine, it works fine.

  1. My expectation & question is: Is this a bug, and if not how should I format parameters for an RPC call when using VSCode?

The shell is taking the quotes out. '{}' is not a valid JSON string, but {} is.
When you are not in the shell (“terminal”), you don’t need to use quotes, you need to use them in the shell because the shell uses spaces to separate parameters.

2 Likes