I have a complex JSON I return it to view and in the view I am trying to just print some values but they are printed out with “”.
#{list items:hotels.results, as:'hotel'}
${hotel.name}
#{/list}
so for instance hotel name will be "Golder Hotel" (but it should be Golder Hotel).
Is there any way to escape quotes (instead of doing replace("\"",""))?
Don’t use
replace("\"",""), because if your string isI said, "Good night", it will beI said, Good night, and you lose your full message.Actually, in your example,
hotelis JSONObject, andhotel.nameis JSONString (not String). When you write${hotel.name}, Play! implicit that${hotel.name.toString()}, and JSONString will be add quote.So, to solve this problem, you need to write
${hotel.getAsString("name")}I think it’s helpful.