current position:Home>Cannot unmarshal array into go value of type main

Cannot unmarshal array into go value of type main

2022-06-24 06:24:23Tsingsee green rhino video

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 .

copyright notice
author[Tsingsee green rhino video],Please bring the original link to reprint, thank you.

Random recommended