Linux

SyntaxError: Unexpected token c in JSON at position 1 when you POST JSON data with curl

Posted on Updated on

When trying to use curl to POST data to your api and getting an error?

The error:

SyntaxError: Unexpected token c in JSON at position 1

Answer

You need to wrap your json block in quotes

curl -X POST -H "Content-Type: application/json" -d '{"content":"a"}' your_url_here

Ah grep you are a time saver

Posted on

Searching for a function valid_move that was made in one of my tttt dirs 

How to quickly find it with out manually going to each file?

grep -R “valid_move” ttt*

Ubuntu: Install Visual Studio Code via apt-get

Posted on Updated on

Why fiddle with downloading from the browser when apt-get will do?

sudo add-apt-repository -y "deb https://packages.microsoft.com/repos/vscode stable main"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF
sudo apt update
sudo apt -y install code

If need upgrade

sudo apt -y upgrade
sudo apt -y dist-upgrade

great answer from zurfyx

https://askubuntu.com/questions/616075/how-do-i-install-visual-studio-code

 

 

Advertisement