Skip to content

Issue found in Serialize method under the Utils class. #1

Open
@DilipNikam

Description

@DilipNikam

I have user without core version of library. In my case I am using the template and my parameter dynamically send from my code. When I have used this utility found bug while Serialize the object. Below is the method is used in code

`using (var jsonWriter = new JsonTextWriter(writer))
{
serializer.Serialize(jsonWriter, objectToSerialize);
return jsonWriter.ToString();

//Console.WriteLine(writer.ToString());

}`
This method not created json string properly. So I have change the code as below.

`using (var jsonWriter = new JsonTextWriter(writer))
{
//serializer.Serialize(jsonWriter, objectToSerialize);
//return jsonWriter.ToString();

return JsonConvert.SerializeObject(objectToSerialize).ToString();
    //Console.WriteLine(writer.ToString());

}`

After that all is working fine. It will help some who uses the templates. Please comment is there any better option available that this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions