A downloadable project

Spike Three - Convert item data from a csv into JSON with C#

Introduction

This spike will explore the process of converting the data in the team's csv into a JSON file using c# for the in game items. This task will contribute towards the goal of our in game items being populated by data originally from a csv.


Goals

  1. Research how to convert a csv into a JSON using c#.
  2. Implement the solution found of converting the games item set data from a csv into a JSON using c#.


Personnel

Primary        -  Zackery Camille [1095725]

Secondary  -  Ben

Secondary  -  Christian


Technologies, Tools, and Resources used


Tasks Undertaken

  1. Remove (delete) the previously made scripts from the past spike reports.
  2. Read through and implement the solution from the 'CSV Reader' in the Technologies, Tools, and Resources used section but apply your own data specific information when necessary.
    1. Be sure to add the text asset that gets created from the csv data to the script when it is added to a object.


What was found out

The completion of this task went over two weeks as initially I failed to entirely understand the logic behind approaching the research and implementing it. In the first week I was trying to find a way to directly save a csv file as a json file instead of building off of the work I had done in previous weeks. 

In the previous weeks I worked on parsing in the data from a csv and adding it to a list and it wasn't until the beginning of the second week that Christian had brought to my attention that I was in fact approaching this task with the wrong logic in mind. He was also the one to point out that I had failed to acknowledge that I wasn't expanding off of my previous work.

 Later that day Ben had found a source (as seen in the resources section) and implemented the code to read in a csv into a list, create a json file and then populate that file with the data from the list. I appreciatively accepted the source from Ben but not his personal code as I wanted to complete the task as much as I could myself.


Solution Justification

The solution that was founded by Ben helps accomplish everything that I have been striving for the past few weeks all in the one script. So as a means to reduce the number of scripts used this solution was used in addition to the fact that after two weeks of working on this task as a means to move forward I chose to stick with this solution. 

In addition this solution strips the data from a text asset and parses it into arrays of strings opening the data up to be used. This resolves the issue that was raised in the first spike detailing that text assets were read only.

Leave a comment

Log in with itch.io to leave a comment.