Create JSON from Datable for ERR

Hello,

I’m trying to dynamically create a JSON file from using data from an excel file that is output in a specific format to meet Enhanced Reporting Requirements (ERR) so that it can be sent via API.

The JSON should be similar to what is shown here: PAYE Employers REST API

Using many “Assigns” I have been able to create this file (using hard coded values with made up data) that looks to be in the correct format:
CreatedJSON.json (805 Bytes)
Create JSON.xaml (19.5 KB)

However it is not dynamic and I’m struggling to find a better way to implement this.

Example of data to be used

Example table.xlsx (8.9 KB)

I have read the data, putting it into a data table, looping through to populate the variables and serialising the object to then write the file but that outputs this file which isn’t quite right:

NewJsonFile.json (1.2 KB)

Thank you

@OTK90

One way you can do is add tags in place of values and in for loop on datatable replace those tags with actual values this way as the structure is already there we only need to add the new values

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.