How to deal with the motoko language keyword as the record key name

When I convert JSON in the module serde (Mops • Motoko Package Manager), the JSON data key contains the type keyword, so it cannot be passed when defining the data type model.
How to deal with this situation ni

Example JSON string

{
type : "TriggerSmartContract",
other : "other"
}

Motoko does not support it

type RawData = { 
  type : Text;
  other : Text
};

First thing that comes to mind that you could try is to put the key in double " or single ’ quotes.

Edit:

Adding _ at the end of the key seems to work according to this thread How to create a Motoko type which has a reserved word as a property identifier?

2 Likes