Implemented custom JSON Encoder to handle FieldDefinition instances