kwent / syno

Simple Node.js wrapper and CLI for Synology DSM REST API 5.x and 6.x.
http://kwent.github.io/syno
MIT License
316 stars 51 forks source link

Unexpected token ' in JSON at position 0 #77

Open zer0factor opened 11 months ago

zer0factor commented 11 months ago

Ran into this problem when creating a bash script.

!/bin/sh

echo --- Getting link --- link=123 echo --- Link aquired ---

SURI="'{"'"uri"'":"'"'"$link"'"'"}'" echo PhasedURI "$SURI"

syno dl createTask --payload "$SURI"

[ERROR] : JSON Exception : SyntaxError: Unexpected token ' in JSON at position 0 at JSON.parse () at execute (/usr/local/lib/node_modules/syno/bin/syno.js:49:20) at Command. (/usr/local/lib/node_modules/syno/bin/syno.js:292:10) at Command.listener (/usr/local/lib/node_modules/syno/node_modules/commander/index.js:370:29) at Command.emit (node:events:513:28) at Command.parseArgs (/usr/local/lib/node_modules/syno/node_modules/commander/index.js:892:12) at Command.parse (/usr/local/lib/node_modules/syno/node_modules/commander/index.js:642:21) at Object. (/usr/local/lib/node_modules/syno/bin/syno.js:353:9) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)