Question: In this lab, your initial focus will be on understanding various file formats, such as XML , JSON, and CSV . This involves understanding their
In this lab, your initial focus will be on understanding various file formats, such as XML JSON, and CSV This involves understanding their structures and how they represent data.
Following this, you will proceed to create endpoints for a specific resource within your web service. These endpoints will be designed to serve the resource using three different file format representations, allowing clients to interact with the data in XML JSON, or CSV
The entire process, from handling file formats to exposing the resource through endpoints, will be facilitated by the GlassFish server, which serves as the hosting environment for your web service.
Prerequisites
Ensure your GlassFish setup is functional, as this lab is a continuation from Lab
Lab Work
Part File Creation
Given the dataset below represented in a tabular format, your task is to transform it into other file formats.
name id gpa
Ryan Gosling
Keanu Reeves
Richard Dean Anderson
Brad Pitt
Ed Norton
Helena Bonham Carter
Convert the data above into the following formats:
JSON
XML
CSV
Name each file students eg students.json and place them within srcmainresources
For the purpose of autograding, follow these formatting guidelines for each file type:
For all formats:
Fields for each record should be lowercase eg name and not NAME
Fields should be ordered as: name, id gpa
Records should be sorted by the value of id from least to greatest
For JSON:
All the records should be stored in an array named students
Each record should be a JSON object with following fields and value types:
name is a string
id and gpa are numbers
For XML:
The parent element should be called students
Each record should be called student
Each field in a record ie name, id and gpa should have its own tag eg
Include an XML header at the beginning of the file with following attributes:
version:
encoding: utf
For CSV:
Header should be copied from the table above
Delimiter should be a comma
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
