成功解決:chaincode argument error: json: cannot unmarshal xxx into Go struct field .Args of type string

Fabric在調用鏈碼時候報錯:

Error: chaincode argument error: json: cannot unmarshal number into Go struct field .Args of type string

Error: chaincode argument error: json: cannot unmarshal bool into Go struct field .Args of type string

數據在結構體中有字符串布爾浮點整型,如下所示:

調用的指令是

主要看傳參處,按照結構體中數據類型進行傳參,整型布爾浮點型數據都沒有雙引號,但是調用時報錯

解決方法是在調用時在所有參數處都加上雙引號,此做法並不會改變數據類型,可以在調用後根據key查詢得以驗證

成功解決:chaincode argument error: json: cannot unmarshal xxx into Go struct field .Args of type string的問題

歡迎小夥伴討論,如有錯誤請在評論區評論或發私聊消息,謝謝你。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章