2017-08-16 9 views
0

curl命令來嘗試發佈二進制數據在JSON發佈二進制數據給出的JSON錯誤意外的標記使用捲曲

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 

一個JSON文件給出了一個錯誤400

Unexpected token \u0011 in JSON at position 13 

enter image description here

它出現錯誤是因爲json 內容中的數據是二進制包含0x11 JSON不允許。如何使用cURL在utf-8中進行編碼,然後發送。

這裏是二進制 enter image description here

回答

0

文件嘗試編碼的二進制數據爲Base64,