ballerina-platform / ballerina-library

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

Error when using `parseAsType` json in to given record with field as escap characters #6993

Open lnash94 opened 2 weeks ago

lnash94 commented 2 weeks ago

Description: Please refer to the below sample

type A record {
    @jsondata:Name {value: "c"}
    int a\-name;
    string b\-name;
};
public function main() {
    A|error z =  jsondata:parseAsType({c: 10, b\-name: "a"});
    io:println(z);
}

When it runs it gives a below error

error Error ("required field 'a-name' not present in JSON")

Expected output

{"a-name":10,"b-name":"a"}

Suggested Labels:

Suggested Assignees:

Affected Product Version:

OS, DB, other environment details and versions:

Steps to reproduce:

Related Issues:

SasinduDilshara commented 6 days ago

This issue will be fix with the https://github.com/ballerina-platform/ballerina-lang/pull/41540/files. It is not merged into master branch yet