Creating JsonDataSource from JSON string

Hi @tahir.manzoor,
Just wanted to know if the below logic is the right approach.
I have a json string and I am converting it into stream and then passing it into JsonDataSource.

Document doc = new Document("SampleDocument");
string json = "SampleJson";
MemoryStream j = new MemoryStream(Encoding.UTF8.GetBytes(json ?? ""));
JsonDataLoadOptions options = new JsonDataLoadOptions();
options.AlwaysGenerateRootObject = true;
JsonDataSource dataSource = new JsonDataSource(j, options);
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, dataSource);

Let me know if this is the correct approach.

@mamatha.n Yes, your approach is correct - it is required to put JSON string into a stream and then use the stream for creating JsonDataSource.