Skip to content

json_name field option not working #248

@junghoahnsc

Description

@junghoahnsc

Hello,

I'm using 'json_name' field option, but it doesn't work.

My proto is

message GeoCoordinate {
  double latitude = 1 [ json_name = "lat" ];
  double longitude = 2 [ json_name = "long" ];
}

But in Go,

a := GeoCoordinate{}
a.Latitude = 1.2

b, _ := json.Marshal(a)
fmt.Printf("a=%s\n", string(b))

The output was

a={"latitude":1.2}

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions