-
-
Save sago35/31f13b47b7da4f44d7ddb714b15e8b2c to your computer and use it in GitHub Desktop.
TinyGo 0.28 vs encoding/json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func main() { | |
v := TargetJSON{} | |
json.Unmarshal([]byte(targetJSON), &v) | |
b, _ := json.Marshal(v) | |
fmt.Printf("%s\n", string(b)) | |
} | |
const targetJSON = ` | |
{ | |
"build-tags": ["wioterminal"], | |
"flash-method": "msd" | |
} | |
` | |
type TargetJSON struct { | |
BuildTags []string `json:"build-tags"` | |
FlashMethod string `json:"flash-method"` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment