You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import ballerina/io;
import ballerina/data.jsondata;
type DDPerson record {|
readonly int id;
|};
public function main() returns error? {
string user2 = string `{"id": 4012}`;
DDPerson r2 = check jsondata:parseString(user2);
io:println(r2.id);
}
The above code give following error
error: {ballerina}TypeCastError {"message":"incompatible types: 'error' cannot be cast to '(anydata|data.jsondata:Error)'"}
at ballerina.data.jsondata.0:parseString(json_api.bal:33)
wso2.jsontest.0:main(main.bal:10)
The text was updated successfully, but these errors were encountered:
The above code give following error
The text was updated successfully, but these errors were encountered: