Using Julia to open a JSON file that is located at a particular directory

Suppose there is a JSON file at a particular location. Let's say at "C:\Data\". Using Julia, how do I load the file, so that I may use its content for analysis?

The following link provides access to a sample of my JSON files. For the readers information, I am in the process of learning how to extract market data from Betfair.

Link: Betfair JSON File Example

1 Answer

You just specify the full path to the file to the JSON parser you are working with. For example with the JSON package:

julia> using JSON julia> JSON.parsefile("/Users/fredrik/test.json") # full path Dict{String,Any} with 2 entries: "hello" => 1 "world" => Any[1, 2] 

If you are running the code in the same directory as the JSON file you can just use the filename since Julia defaults to look in the current directory:

julia> JSON.parsefile("test.json") # relative path Dict{String,Any} with 2 entries: "hello" => 1 "world" => Any[1, 2] 
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like