+ Start a Discussion
inbox outbox 7inbox outbox 7 

JSON vs JSONGenerator class: Could any one tell me the difference?

Hello guys, 

Could any one tell me the difference between these two classes?
We have Auth 2.0 JWT Bearer token flow for Einstein API Authentication. 
To generate the JWT file, can we use JSON.serialize() method instead of JSONGenerator class.?

Eg. code:
JSONGenerator body = JSON.createGenerator(false);
        body.writeStartObject(); // {
        body.writeStringField('iss', this.iss);
        body.writeNumberField('iat', rightNow);




 
Best Answer chosen by inbox outbox 7
SwethaSwetha (Salesforce Developers) 
HI,
Does the post https://salesforce.stackexchange.com/questions/81468/json-serialize-vs-json-generator answer your question?

If yes, please close the thread by marking answer as best.

Thanks
Swetha