将docker-compose.yml转换为DockerAPI / services / create接受的json?

I want to deploy service into already running Docker Stack via Docker API for Go-lang.

As dockerAPI only accepts json as described in their docs, I an searching for a tool that could covert compose.yaml to the json accepted by dockerAPI.

Alternatively, it would be great if there is any method in go-lang DockerAPI that can create service directly using yaml data as we provide in compose.yml.

Example Yaml:

myapp: image: amithp/pyapp:latest deploy: replicas: 3 restart_policy: condition: on-failure networks: - frontend-network environment: - MYENV=myapp labels: myproject: "xyz" label1: "somevar"

I am fairly new to both DockerAPI and Go-lang, any suggestion or direction will be greatly helpful.