Dynamic JSON String Format in Apex

The reason I’m creating this post because I spend a lot of time on this by just putting some double Quotes, single Quotes blah blah.  I just want to save your time by showing you a demo of the JSON String i.e dynamic.

Most of the time you need a dynamic JSON while writing a test class where the input is a JSON string and to test your use case you need to enter your record data into the string so I’m really in a mess while creating a Dynamic JSON for my Test Class.

So check this out.

 

Here is the Dynamic JSON Highlighted Code:

 

Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *