Consider a language agnostic format like protobuf, avro, or thrift. For starters you can have a shared repo with the schema and then import it as a git submodule to any service that requires it. You'll need a strategy for handling schema evolution to ensure that there are not breaking changes to the shared schema.
If you want something more sophisticated take a look at Buf.build and their tooling (BSR, Buf CLI) that facilitates sharing message formats at scale.