An issue with parsing .json file that consists of a list of .jsons

Hi everyone, 

recently I encountered an issue with parsing a .json file. 

Here is how the file looks: 

Screenshot of a JSON file with multiple objects, highlighting the object with 'Name': 'AutoRunValidationError'. Fields like 'RibbonText', 'Notification', and 'Description' contain error messages.

This is a list of jsons within a json. Values for the following keys need to be localized: LanguageID, RibbonText, Notification, Buttons (if the strings is not "null"), Description, Subject and Value. 

Until now I have been using out of the box .json parser (Add-in JSON Parser). However, when the file was updated and a new .json (with the exact same structure) has been added to the file between already existing .jsons and, as a result I had a leverage loss. 

Below is a screenshot for visualization: 

Screenshot of a JSON file showing an object with 'Name': 'AutoRunValidationError' above and a new object 'AutoRunFailed' inserted below, indicated by a red arrow and text 'New .json was added here'.

Since the structure for all of the .jsons within this file is the same and there are no unique keys, new json jumped in the place of the one with name "AutoRunFailed". For Passolo, string IDs remained the same, but the source changed.  I lost leverage for everything that is below the red arrow (highlighted in yellow). Strings had the untranslated status and Passolo suggested teh old translations. 

I was able to recover my translations, by moving the new .json to the very end of the file and leveraging translation from a copy of Passolo project, however this is not a long term solution. The same issue will come up again when this file is updated. 

I contacted the support and they confirmed that there is no other way around. So we tried to come up with a custom txt parser. Using value for "Name"  as string ID (in yellow) for all of the values in green - screenshot below. 

Close-up of a JSON object with 'Name': 'AutoRunValidationError'. Fields such as 'RibbonText', 'Notification', and 'Description' are highlighted in green.

I managed to achieve that very easily with the first string (String id: "AutoRunValidationError" Parsed string: "1033"). Simply by doing the following:

 Screenshot of a Passolo 2022 parser configuration window with fields for string begins with, string ends with, and ID of string.

 

However I am stuck when I want to move on to the next strings.

With help from support I managed to set "AutoRunValidationError" as string id for "RibbonText" by doing the following: 

Screenshot of a Passolo 2022 parser configuration window showing a regular expression used to define the beginning of a string and the ID of the string.

 I tried to use the same rule and changing "RibbonText" with "Notification" and it simply does not work. Ans support is not able to help here. 

Does anyone has an idea how to make it work so that I can AutoRunValidationError set as string id for all the values that need to be localized? 

Or maybe we can achieve that with a different parser? 

I would very much appreciate your help with this ;)

I am using Passolo 2022



Generated Image Alt-Text
[edited by: RWS Community AI at 12:15 PM (GMT 1) on 13 Jun 2024]
emoji
  • Foremost, the statement from the support colleagues is correct that an unstructured JSON list is supported, but that it is then no longer possible to identify where a new list entry was inserted during the update. A solution approach using the text parser is promising, but I would proceed differently. Unfortunately, the file wasn't attached, and I didn't want to type it all out. So I only generated a small sample file and some adjustments are still necessary.

    Define a Resource group that takes the content of "Name" as the group name:

    Dialog box titled Resource tags with fields for Identifier begins with, ends with, a checkbox for Use regular expression, a blank Resource type field, and an OK button.

    Then define the translatable elements by naming them in a RegEx list (separated with | ), and use their strings as IDs within the groupings:

    Dialog box titled String tags with fields for String begins with, ends with, checkboxes for Use regular expression and Segment strings, dropdowns for ID of string and Comment of string, and an OK button.

    Please note that my list is just an example, you need to insert all your items you want to see in the translation list. This will then result in a nicely structured translation list that will also works when updates are inserting new JSON list items with a new "Name" content.

    Screenshot of a software interface showing a Resources panel with a tree view of items labeled test Strings Auto1 to Auto4, and an adjacent panel listing All strings with columns for Number, ID, State, and Text.

    It might be necessary to add mappings when text strings do contain escaped double quotes and you might want to optimize the list view by activating the Inline Patterns for HTML, so that tags appear tagged in the translation editor.

    emoji


    Generated Image Alt-Text
    [edited by: RWS Community AI at 7:08 AM (GMT 1) on 20 Jun 2024]
  • Hi Achim Herrmann, 

    thank you so much for looking into this. The solution you suggested works like a dream!

    Also, thank you for suggesting to use mapping. I used it - strings are parsing well and files are generating correctly. 

    Indeed, it would be difficult for linguist to translate with all that noise. I am using inline patterns for the tags ;)

    Kind regards, 

    Marta Stachura. 

    emoji