ballerina-platform / ballerina-library

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

Add support for binding JSON payloads to a Ballerina record in the Copybook module #6940

Open MohamedSabthar opened 2 months ago

MohamedSabthar commented 2 months ago

Description: In the future, we need to support an API that directly binds the value produced by the fromBytes() method to a Ballerina record type and performs constraint validation. We could introduce a similar API as shown below:

public isolated function fromBytesWithType(byte[] bytes, string? targetRecordName = (),
   Encoding encoding = ASCII,  typedesc<record{}> targetType = <>) returns targetType|Error;

Describe your problem(s)

Describe your solution(s)

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):