[Tutorial: YAML to JSON on Windows] Converting the Static Data Export (SDE)

I would have added images but “Sorry, new users can not upload images.”. Thanks CCP! Also, I don’t have time right now to format this properly since I don’t yet understand these tags from the new forums… I’ll work on it later!

Conversion to specific databases is outside of the scope of this tutorial. Also, conversion from JSON to a specific database should be well documented on the web and you’ll most likely find what you need.

In this tutorial:

  1. Create a folder to place all the documents in
  2. Download the Static Data Export (SDE)
  3. Download and install Ruby
  4. Ruby script to convert YAML to JSON
  5. Using Windows command line to run the Ruby script

Let’s begin.

1 - Create a folder to place all the documents in

Choose a place in your disc and create a folder for the project. On this example, I’ll create a folder on my Desktop named “eve_db_conversion”. This will be our working directory.

2 - Download the Static Data Export

Go to https://developers.eveonline.com/resource/resources and download the file named “sde-20170712-TRANQUILITY.zip” under “STATIC DATA EXPORT (SDE)

Extract the zip contents on your Desktop and find the file you need inside the “sde” folder. For example, I want the items from the game: inside the extracted folder go into the “fsd” folder, then, grab the file “typeIDs.yaml” and place it on the root of our working directory. Your working directory should look like this:

eve_db_conversion
–typeIDs.yaml

3 - Download and install Ruby

We will use Ruby’s libraries to handle the conversion for us, so go to Downloads and download Ruby.

Start the installation and, on the installation’s second page, make sure the option to “Add Ruby executable to your PATH” is checked. You will have issues later if not.

On the post-installation page, uncheck the box for “Run ‘ridk install’ to install MSYS2…” since we don’t need that.

4 - Ruby script to convert YAML to JSON

Go to your working folder and create a new text document with w/e name. Open it and paste inside the following code:

#YAML 2 JSON
require ‘json’
require ‘yaml’
input_filename = ARGV[0]
output_filename = ARGV[1] || input_filename.gsub(/(yml|yaml)$/, ‘json’)
input = JSON.pretty_generate(YAML.load(File.read(input_filename)))
File.open(output_filename, ‘w’) do |out|
out.write input
end

Save the text file and close it. Now rename it to “yamlparser.rb”. Your working folder should now look like this:

eve_db_conversion
–typeIDs.yaml
–yamlparser.rb

5 - Using Windows command line to run the Ruby script

Open the command line prompt for Windows. Hold Windows key and press R to open the run command window and type “cmd”. Press “Run”.

On the command line go to your working folder by typing “cd Desktop\eve_db_conversion” and then press Enter on your keyboard.

Now type into the command line “ruby yamlparser.rb typeIDs.yaml”, press Enter on your keyboard and WAIT.

You now have an extra file on your working directory named “typeIDs.json”. Open that and be happy!

That’s all. I’ll maybe add images later when I get time to upload them somewhere else. Also, if you had any issues or if I skipped a step, let me know and I’ll fix it!

Cheers!

1 Like