a11y.skipToMainContent
1

Go Struct에 JSON

JSON 샘플을 붙여넣고 Go struct 정의를 일치시킵니다. - 옵션 <code>json:"..."</code> 태그, <code>omitempty</code> 및 nullable 값에 대한 포인터 필드.

More options
Was this tool helpful?
Send output to:
Advertisement

How to use JSON to Go Struct

  1. JSON 객체를 붙여넣기 (또는 Load Sample를 클릭합니다).
  2. Root struct name (기본값: 루트)를 선택합니다.
  3. Tick json struct 태그, omitempty, 또는 당신이 원하는 경우 pointer-for-optional.
  4. 생성 된 Go 코드를 프로젝트로 바로 복사합니다.

JSON을 Go Struct로 변환은 무엇입니까?

제3자 API를 위한 손으로 쓴 structs의 보일러판을 저장하십시오. 발전기 infers 유형 (int64, float64, bool, string) 및 recursively 개체의 배열을 포함하여 모든 배열 객체에 대한 파괴를 생성합니다. json struct 태그를 추가하면 encoding/json 패키지 맵 필드가 자동으로 표시됩니다.

Advertisement

FAQ

지원되는 배열 객체?
예 - 각 배열 된 객체는 자체 유형의 struct가됩니다.
내 JSON은 어디에서 업로드됩니까?
이름 * 변환은 브라우저에서 완전히 실행됩니다. 서버로 전송되지 않습니다.

Related tools

Author

MW
Marcus Webb"The DevTool Craftsman"

Full-Stack Developer & Tools Architect

Marcus has been writing code since the dial-up era. He has contributed to open-source developer tools, built CI/CD pipelines for startups, and debugged production incidents at 3 AM more times than he would like to admit. His philosophy is that the best developer tool is the one that gets out of your way, and he writes about practical tooling that helps teams ship faster with fewer headaches.

← Back to Developer Tools · All tags

Last updated:

Advertisement