0

Trying to convert:

Map(1416479696353 -> Map(name -> You,savePoint -> 4),
1416479788969 -> Map(name -> You, savePoint -> 9),
1416479801372 -> Map(name -> govind,savePoint -> 10))

into JavaScript json by:

<script>
var [email protected](data.toMap)
</script>

but giving me this error:

SyntaxError: invalid property id

var info={&quot;1416479696353&quot;:{&quot;name&qu
----------^

How to get in the correct manner?

1 Answer 1

1

You need to escape the HTML, i.e.:

<script>
    var info=@Html(Json.toJson(data.toMap));
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.