New

Capture JSON string value with new lines as a single segment

JSON strings with new lines (\n)

The following JSON string contains new lines (\n):

"Error_occured_while_submitting_Smart_Hand_request": "An error occurred while\nsubmitting your\nSmart Hands request.",

When processed without Plain Text ECP, the string is correctly extracted as a single segment, with new lines in the source represented as soft returns in the extracted segment:

“An error occurred while
submitting your
Smart Hands request.”

Problem

To handle placeholders in JSON files elsewhere, I need to enable Plain Text ECP. However, once Plain Text EXP is enabled, the same string is no longer extracted as a single segment.

Instead, it is split into 3 separate segments:

“An error occurred while”

“submitting your”

“Smart Hands request.”

 

Each line is treated as a separate segment.

Expected behavior

The entire JSON string value should be extracted as one segment, even when it contains \n (rendered as line breaks), while still allowing ECP to process placeholders.

Question

How can Plain Text ECP be configured so that:

  1. Multiline JSON string value containing \n are extracted as a single segment, and
  2. Placeholder processing via ECP remains enabled?

I raised a support case #CS0052036, and received the following feedback.

We have reviewed your configuration and concluded that achieving your goal with the JSON File Type and text ECP is not possible.

 

The issue arises because the JSON filter converts `\n` into a line break first. Consequently, when the text is processed in plain text format, ECP only takes the content from the beginning of the string to the end, which does not support multiline input.

 

Unfortunately, there is no available workaround unless using the HTML ECP is an option for you.


As this is a filter limitation and not a defect, we recommend posting this request on the internal Ideas portal: https://community.rws.com/developers-more/internal/internal-trados-ideas/