I want to output JSON values in Word, but the JSON nodes are dynamic.
For example, sometimes they are like this: {"data":{"occupation1": {"Other Occupation"}}}
, and sometimes they are like this: {"data":{"occupation2": {"Engineer"}}}
So, I can’t use it like this: <<[data.occupation1]>>
, please help, thanks!!
@zhenglifan
Provided JSON snippets are not valid, they sould be corrected. In this case, it seems like they should be as follows:
{"data":{"occupation1": "Other Occupation"}}
{"data":{"occupation2": "Engineer"}}
If this is the case, then you can use the following template syntax:
<<[data[0]]>>
@ivan.lyagin I need to replace the existing way of generating reports with Aspose. These json files already exist, and I want to implement the existing logic of the current report without modifying the json files, such as dynamic json node, because the json node name can sometimes be ‘occupation1’, sometimes ‘occupation2’ or ‘occupation3’; So I want to see if there is a way to easily get its value and display it in the word, such as : key.startsWith(‘occupation’).value or <<[data.occupation%]>>;
If there is indeed no simple way, I will have to modify the JSON.