Developer forum

Forum » Development » DW Search(Weighted) DwSearchResultSummary tag in JSon

DW Search(Weighted) DwSearchResultSummary tag in JSon

Dmitrij Jazel
Reply

Hi Guys.

We are using Search(Weighted) together with JSon, and Search generates Json data.

Template tag: "DwSearchResultSummary".

When some of the paragraph have a line break in the content, or content has some restricted characters - this causes JSon to compain, and thus throw errors.

 

Any way we could filter "DwSearchResultSummary" tag, and eliminate Linebreak, and other simmilar issues?

We are using Razor to generate JSon.

 

/Dmitrij

 


Replies

 
Kim Søjborg Pedersen
Reply

Hi Dmitrij,

I think you can wrap it like this @i.GetString("Ecom:Product.ShortDescription.JSEncoded()

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

@Kim: You cannot use JSEncoded in Razor as it is a HTML template tag extension method - it only works in HTML templates.

@Dmitrij: HttpUtility.JavaScriptStringEncode your value in your template.

BR Nicolai

Votes for this answer: 1
 
Dmitrij Jazel
Reply

Hi Nicolai :) 

Thanks allot! :) this helped! :)

/Dmitrij

 

You must be logged in to post in the forum