Hello Expert,
I am stuck on this assignment and can't get my code to run. I would really appreciate it if anyone can help me.
Assignment Requirements:
Your software development company wants to continue developing and enhancing a software for internal use.
For this week's assignment, it is required to read from a JSON application file (data.json) containing employee information. You will not use LINQ for this task.
Your tasks include:
Add the following package to the project at the top of the code. using Newtonsoft.Json;
3) Unzip the attached data.zip file which contains the data.json file.
4) Save the data.json file in a folder where your program can read the file.
5) Read and deserialize the JSON file, per the prototype code below.
//-- access the JSON file with the StreamReader -- using (StreamReader r = new StreamReader("data.json")) { //-- Read the JSON file -- string jsonFile = r.ReadToEnd(); //-- Deserialize the JSON format into List object -- Week4List = JsonConvert.DeserializeObject>(jsonFile); }
6) Continue to use the sub classes for the W2 and 1099 employees that inherits the employee data.
7) Remove the filter so all data will show.
8) Include fields and calculations for AnnualTax and AnnualNetPay in the output display. Display the data for the employees on a Windows Form using the ListView control.
Note that I will accept the output in a Console window, but a Form is preferred.
Thanks for the question.
Below is the code you will be needing Let me know if you have
any doubts or if you need anything to change.
Thank You !!
===========================================================================
In python 3, we can use below method.
#Read from file and convert to JSON
import json # Considering "json_list.json" is a json file with open('json_list.json') as fd: json_data = json.load(fd)
or
import json json_data = json.load(open('json_list.json'))
Using with statement will automatically close the opened file descriptor.
String to JSON
import json json_data = json.loads('{"name" : "myName", "age":24}')
Let me know for any question or help.
Get Answers For Free
Most questions answered within 1 hours.