1

i have an object like this:

evticket__c et = [Select Id from evticket__c where Id =: id limit 1]; 

then i serialize it likethis:

String obj = JSON.serialize(et);

is there a way to create a new object with that serialized data something like this:

evticket__c newEt = JSON.deserialize(obj );

Thanks

3

Something like this should work - you need to cast it back to the Concrete object, and specify the type you want the JSON parser to use:

Account a = [Select Id, Name, Type from Account LIMIT 1];
String sJSON = JSON.serialize(a);

Account js = (Account)json.deserialize(sjson, account.class);
system.debug(js);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.