Skip to content

a Go package to find Japanese address data from Japanese postal code

License

Notifications You must be signed in to change notification settings

syumai/go-jpostcode

Repository files navigation

go-jpostcode

Go Reference

  • go-jpostcode is a Go package to find Japanese address data from Japanese postal code.
  • This package requires Go 1.16+.

Usage

// Find an address
address, err := jpostcode.Find("0010928")

// Search addresses (Some addresses have same postal code)
addresses, err := jpostcode.Search("1138654")

// Print address as a JSON
addressJSON, err := address.ToJSON()
if err != nil { // error handling }
fmt.Println(addressJSON)

Example

$ go run example/server/main.go
$ curl http://localhost:8090/0010928

Install a CLI tool to get address from postcode

  • A CLI tool is given as jpost.

Installation

go install github.com/syumai/go-jpostcode/cmd/jpost@latest

Usage of jpost

  • To get address, just give postal code as argument.
# Get address from postal code: 0010928.
$ jpost 0010928
{"postcode":"0010928","prefecture":"北海道",...

Update jpostcode-data

$ make update

License

  • MIT

Author

Original data

About

a Go package to find Japanese address data from Japanese postal code

Resources

License

Stars

Watchers

Forks

Packages

No packages published