Hi,
What approach should we take to fulfill the requirement of extracting data from CSV file, displaying row data on HTML page and converting CSV data into JSON to publish it to external systems?
Thanks,
Solved! Go to Solution.
Views
Replies
Total Likes
Basically you can use sling model to write your backend code to read the csv data and expose it on the HTML as we use it normally. On the same sling model you can you use sling model exporter as well using https://medium.com/@toimrank/aem-sling-model-exporter-90dc872835b9. by default you access the json with the component path on the page using page-component.model.json and if you want to access only with pagename.model.json then you can write a sling servlet that will get bind at template level and from where you can call your sling model.
Hi,
If the requirement is to convert CSV data into HTML and then into JSON, one possible approach could be the following:
Utilize the Content Fragment API to convert each row of CSV data into a separate Content Fragment.
Assemble these Content Fragments into an HTML page, Use the Content Fragment List component
publish it as a Content Service, which can then be consumed as JSON.
Getting Started with AEM Headless - Content Services | Adobe Experience Manager
You can write sling model exporter that can read value from csv file and can be used to write data in html as well exposed it as JSON using model.json
Hi @DPrakashRaj can you please elaborate the appraoch, what exactly you want to say here
Basically you can use sling model to write your backend code to read the csv data and expose it on the HTML as we use it normally. On the same sling model you can you use sling model exporter as well using https://medium.com/@toimrank/aem-sling-model-exporter-90dc872835b9. by default you access the json with the component path on the page using page-component.model.json and if you want to access only with pagename.model.json then you can write a sling servlet that will get bind at template level and from where you can call your sling model.