This is a creation in Article, where the information may have evolved or changed.
Similar to this CA, if the instance is converted to json.list it becomes a string.
[CPP]View Plaincopyprint?
- type ca struct {
- list [] uint8
- }
-
- Func main () {
- ca := ca{[]uint8{1,2,3,4,5,6,7,8,9,0}}
- r, _ := json. Marshal (CA)
- fmt. Println (String (r)) //{"List": "aqidbaugbwgjaa=="}
- }
Type CA struct {List []uint8}func Main () {CA: = Ca{[]uint8{1,2,3,4,5,6,7,8,9,0}}r, _: = json. Marshal (CA) fmt. Println (String (r))//{"List": "aqidbaugbwgjaa=="}}
And what we want is a normal JSON. Only int8 byte uint8 this 8-bit JSON library will treat us as strings. Want to solve. If you shoot your head, you can't use these types. 16 32 64 digits are required to convert to JSON strings normally.
[CPP]View Plaincopyprint?
- {"List": [1,2,3,4,5,6,7,8,9,0]}
{"List": [1,2,3,4,5,6,7,8,9,0]}
But don't worry. Unmarshal the JSON string that we think we don't want to go back to the other instances of the CA will get the desired result.
If it's a cross-language JSON communication, be careful.