Skip to content

joshbode/JSONStreams.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSONify.jl

Lossless conversion of custom Julia objects to and from JSON.

Build Status Build status

Coverage Status codecov.io

This package was motivated by improving the de/serialization of DataFrames from/to JSON. More types will be added as required.

Example

Convert a DataFrame to JSON and back, preserving column types.

import JSONify
using JSON
using DataFrames

# Complete data
data  = DataFrame(a = ["a", "b", "c", "d"], b = rand(4), c = [1, 2, 3, 4])
x     = JSON.json(data)             # Convert DataFrame to JSON
data2 = DataFrame(JSON.parse(x))    # Parse x from JSON to DataFrame
data2 == data                       # true
eltypes(data2) == eltypes(data)     # true, types are preserved

# Missing data
data[1, :a] = NA
data
x     = JSON.json(data)
data2 = DataFrame(JSON.parse(x))
isequal(data2, data)                # true
eltypes(data2) == eltypes(data)     # true

About

JSON.jl + DataStreams.jl = JSONStreams.jl

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages