JSON string with special characters stored in dmn table

I want to access this json string using rest endpoint POST “/rest/decision-definition/key/buyFlowPagesNavigation/evaluate” ,
I am getting parsing error
syntax error at position 256, encountered ‘re’, expected ‘}’ …
All I want to return the json string added in dmn table as string without any parsing

<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd" id="Definitions_1g9nmhw" name="DRD" namespace="http://camunda.org/schema/1.0/dmn" exporter="Camunda Modeler" exporterVersion="3.3.4">  <decision id="buyFlowPagesNavigation" name="Buyflow Pages Navigation">    <decisionTable id="decisionTable_1">      <input id="input_1" label="Is Tenant">
        <inputExpression id="inputExpression_1" typeRef="boolean">          <text>isTenant</text>
        </inputExpression>      </input>
      <output id="OutputClause_0t1fqii" label="Page Content" name="pageContent" typeRef="string" />
      <rule id="DecisionRule_1e5ho8c">        <inputEntry id="UnaryTests_13kvsxg">
          <text>true</text>        </inputEntry>        <outputEntry id="LiteralExpression_0h9mrou">          <text>'{
  "txtSessionBtnLabel": "CONTINUE SHOPPING",  "txtSessionExpiredMsg": "Please go back to the Offers Page to reselect a promotional offer.",  "txtSessionTitle": "Hurry, lock in your order before your session expires",  "txtSessionExpiredTitle": "We're sorry, your session has expired",
  "txtSessionTimeRem": "Time Remaining:",  "txtSessionExpiredBtnLabel": "START OVER",
  "txtSessionMsg": "If your session expires, you will lose all current progress including any offer selections and special pricing."}'</text>        </outputEntry>      </rule>    </decisionTable>  </decision>
</definitions>

Hi @javapassion,

the parsing fails because the JSON contains a single quote at

…“txtSessionExpiredTitle”: "We’re…

Try to escape it using \.

Best regards,
Philipp

1 Like

Thanks for the reply that solves the issue for small string values stored in dmn table. I have large string value e.g. json string or html which I want to store in dmn table. I am getting
Caused by: org.h2.jdbc.JdbcBatchUpdateException: Value too long for column “”“TEXT_”" VARCHAR(4000)"
which I think due to large string size I am trying to access from dmn table. Can you refer me to java/spring exmpale where custom data type (blob, clob or byte array) is created to save and retrieve such big data in dmn table.

Hmm. You could try to use Spin JSON instead of a JSON string. The output type should be set to json (or something other than string).

However, you should think about building the JSON or HTML outside of the DMN decision table. For example, model a BPMN flow that takes the outcome of the DMN decision table and generate the JSON/HTML in a ScriptTask using Freemaker template engine.

2 Likes

I try your suggestion then the result shown as below

    "area_id": {
      "type": null,
      "value": {
        "name": "Thông tin khoản vay",
        "code": 1
      },
      "valueInfo": null
    }

area_id is output entry with value is json type. Is that correct?