程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Cannot unmarshal array into go value of type main

編輯:Python

At present, our EasyCVR Developing on AI Relevant contents of intelligent identification and Analysis , Many users are also interested in us AI I'm curious about the implementation and functions of , But this version is still in internal test and adjustment , Not online yet . We still share our thoughts about AI Implementation process of intelligent analysis , So if you are interested, you can pay attention to us .

In intelligent analysis , We use python License plate recognition , The way is to write a python http Interface , use go Detuning python License plate recognition interface , But when you get the data for conversion , The following error occurred (json: cannot unmarshal array into Go value of type main.LPRData), No information to print .

To analyze problems :

1、 Check whether the interface is invoked in the code to return the request interface code

Print data :

Explain the request http Interface success .

2、 In the json String conversion struct, The definition is as follows :

The conversion function is as follows :

3、 Let's guess if this function can't be converted , So write another function to test the transformation . The code is as follows :

The test results are as follows :

Conclusion :json.Unmarshal It can be converted into struct

4、 After research, we learned that , In the request http When you get the data , This data is an array , So the conversion is wrong , You need to change the converted code into an array .

The results can also be output on the console :

expand :

EasyCVR The intelligent video monitoring platform is based on the Internet platform , Taking digitization and informatization as the development direction , Intelligent analysis and processing of video through computer vision technology , Automatic monitoring in the whole process under unmanned conditions . If you want to know more about EasyCVR platform , Welcome to get the test account to test .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved