Идея состоит в том, что я хочу использовать json из маршрута (scala.html), а затем нарисовать его с помощью D3. К сожалению, когда строка передается javascript, она содержит кавычки в исходном JSON.
@(userId: Int, advertiserId: Int, json: String)
@main {
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<table id="split">
<thead></thead>
<tbody></tbody>
</table>
<script type="text/javascript">
@{
// This is the correct json
println(json)
}
// OK malformed JSON
console.log(@json);
</script>
</body>
}
Это из консоли Javascript console.log([{"id":1,"campaignId":1}];
Я что-то пропустил?