ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
136 stars 64 forks source link

The `Name` annotation is disregarded when `toJson` is used with tables #7348

Closed MaryamZi closed 1 week ago

MaryamZi commented 1 week ago

Description

$title. https://github.com/ballerina-platform/module-ballerina-data.jsondata/pull/35 has addressed lists and mappings, but not tables.

Steps to Reproduce

import ballerina/data.jsondata;
import ballerina/io;

type Foo record {|
    @jsondata:Name {
        value: "a-b"
    }
    int a;
|};

public function main() {
    table<Foo> foo = table [
        {a: 123}
    ];
    io:println(jsondata:toJson(foo));
}

Version

0.3.0-SNAPSHOT

Environment Details (with versions)

No response

MaryamZi commented 1 week ago

Need to consider https://github.com/ballerina-platform/ballerina-library/issues/7326 also when fixing this.