0

The curl command to try and post a JSON file with binary data

curl -X POST -H "Content-Type:application/json;charset=utf-8" -H "Accept: application/json" --data-ascii @filename.json http://localhost:3002/api/xyz -v -s

Gives an error 400

Unexpected token \u0011 in JSON at position 13

enter image description here

It appears the error is because data in json content variable is in binary containing 0x11 which JSON doesn't allow. How to encode it in utf-8 in cURL before sending this.

Here is the file in binary enter image description here

0

1 Answer 1

0

Try Encoding your binary data to base64,

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.