Warning
This project is archived and no longer maintained. It wraps a parser that is incomplete and misparses some PSA files. For a more complete reader, see Vazen's PSA support.
psa-parser-go is a cgo wrapper around the vendored C psa-parser library. It parses PSA planogram content from a file path or byte buffer and returns a typed Go Document model that mirrors the C library's JSON document output.
This project is not affiliated with, endorsed by, or sponsored by Blue Yonder, JDA, or any related vendor. Product and company names are trademarks of their respective owners.
The project does not include proprietary documentation, vendor software, or customer planogram files.
- Archived; no further development or support.
- Behavior follows the vendored C parser snapshot, which is incomplete and known to misparse some files. Do not rely on it for production data.
- Breaking changes were possible in
v0.xand will not be addressed.
- Go
1.25+ CGO_ENABLED=1- C toolchain (
clangorgcc)
Built and tested on Linux and macOS.
go get github.com/ShelfFoundry/psa-parser-go@latest
package main
import (
"errors"
"fmt"
"log"
"os"
psaparser "github.com/ShelfFoundry/psa-parser-go"
)
func main() {
// Parse from file
fromFile, err := psaparser.ParseFile("./sample.psa")
if err != nil {
log.Fatal(err)
}
// Parse from bytes
data, err := os.ReadFile("./sample.psa")
if err != nil {
log.Fatal(err)
}
fromBytes, err := psaparser.ParseBytes(data)
if err != nil {
var parseErr *psaparser.ParseError
if errors.As(err, &parseErr) {
log.Fatalf("parser code=%d message=%q", parseErr.Code, parseErr.Message)
}
log.Fatal(err)
}
fmt.Println(fromFile.Header, fromBytes.Version)
}Typed API:
ParseFile(path string) (Document, error)ParseBytes(data []byte) (Document, error)
Map API:
ParseFileMap(path string) (map[string]any, error)ParseBytesMap(data []byte) (map[string]any, error)
- Numeric fields use
float64,int, andint64. - Extension slot fields are slices (
[]string,[]float64,[]int). - Unknown top-level fields are captured in
Document.Extras.
Failures return *ParseError carrying the C parser's code (CodeIO, CodeParse, CodeInvalidArg, CodeNoSpace, and others).
- Full-document parsing only (no streaming callback API).
- Requires cgo and a local C toolchain.
The vendored C parser lives in third_party/psa-parser. See third_party/psa-parser/UPSTREAM.md.
MIT. See LICENSE.