Exception occurred when pulling a number from json


Product Version:

Please give a brief summary of your issue:
Error found when pulling a number from json in the template

Please describe your issue and provide steps to reproduce it:
Json being used

“root”: {
“legal_heading”: {
“publisher”: “ABC”,
“content”: “End-User Agreement”
“legal_clauses”: [{
“legal_clause”: “Sed ut unde omnis iste natus error sit volup tatem…”
“legal_clause”: “Lorem ipsum dolor sit amet, consec tetuer adipi s…”
“legal_clause”: “pretium quis, sem. Nulla conse quat massa quis eni…”
“legal_clause”: “idunt. Cras dapibus. Vivamus elem entum semper nis…”
“version”: 1

And in the template
{{root.legal_heading.content}} [version: {{root.version}}]

{{loop root.legal_clauses}}



com.pdftron.common.PDFNetException: Exception:
Message: Template error: Text replacement value must be a string in the input JSON. Tag: ‘root.version’.
Conditional expression: val.is_string() || val.is_undefined()
Version : 9.4.2-a2633dd18a
Platform : Windows
Architecture : AMD64
Filename : SimpleTemplateNode.cpp
Function : trn::Layout::SimpleTemplateNode::ProcessText
Linenumber : 205

at com.pdftron.pdf.TemplateDocument.FillTemplateJson(Native Method)
at com.pdftron.pdf.TemplateDocument.fillTemplateJson(TemplateDocument.java:70)

Please provide a link to a minimal sample where the issue is reproducible:

Thank you for reporting this to us. I have passed this information to the team for further investigation. As a workaround, are you able to change the value to a string in your application?

I have no control of the Json string as it will be passed by calling application.

By the way, is there a method in PDFTron to take XML (with namespace and prefix) as input string instead of json?

Hello, at this time, the only input strings we support is JSON. Are you able to pre-process the JSON on your side to modify it?

I cannot modify the json as it is unknown to the application. The caller is passing the json string and the template and the application will call to PDFTron to generate the PDF.

Thank you for the clarification. As mentoned previously, the team is looking into this and I will provide you with an update as soon as I have it.