I have a List of Schema.SObjectfield and I want to convert it to String.
I am getting below error.
System.JSONException: Apex Type unsupported in JSON: Schema.SObjectField
Here is my approach.
public string jsondata{get;set;}
List<Schema.SObjectField> fieldschema = new List<Schema.SObjectField>();
for(Schema.SObjectField sfield : fieldMap.Values()) {
fieldschema.add(sfield);
}
jsondata = JSON.serialize(fieldschema);
jsonstring = (List<jsonvalue>) System.JSON.deserialize(jsondata , List<jsonvalue>.class);
can someone please let me know where is wrong in my approach or how to handle it?