Skip to content

There seems to be an issue during compile with at least one escape sequence #349

Description

@mcgear

I have already created a pull request for you to include that has unit test setup to showcase the error.

#348

Essentially the issue is that when using json like the following:
{"Description":"**\\*.{{Thing.Name}}"}

After running the template through compile:
`var json = new TestJSONObject()
{
Name = "Thing - {{Thing.Name}}",
Description = "**\*.{{Thing.Name}}",
Test = new TestJSONObject()
{
Test = new TestJSONObject()
{
Name = ""{{Thing.Name}}""
}
}
};

 var source = JsonConvert.SerializeObject(json);
var template = Handlebars.Compile(source);
var data = new
{
Thing = new
{
Name = "Handlebars.Net"
}
};
var result = template(data);`

The result comes out with:
{"Description":"**\*.Handlebars.Net"}

And then if i try to parse that json back into object:
var resultJson = JsonConvert.DeserializeObject<TestJSONObject>(result);

An error is thrown because '*' is not a valid escape character:
'Bad JSON escape sequence: \*. Path 'Description', line 1, position 20.'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions