The following code I have implemented in the wicket. It is printing the entire JSON data in a single line. Actually it should print in a JSON format. As of my understanding, the problem is with document.getElementById(''demo'').innerHTML={0}
. Please correct my code if I did anything wrong.
And why (''demo'')
is expecting two single quotes at starting and ending of Html id.
target.appendJavaScript(MessageFormat
.format("document.getElementById(''demo'').innerHTML={0}'", mapper.writerWithDefaultPrettyPrinter()
.writeValueAsString(jsonDataProducer())));