From d8a8b13526a57a50ec8b27a6dd59b9dbcd085fef Mon Sep 17 00:00:00 2001 From: Alexey Stukalov Date: Mon, 8 Jan 2018 21:53:31 +0000 Subject: [PATCH] define JSON.lower(CatValue) fixes #95 --- REQUIRE | 1 + src/CategoricalArrays.jl | 1 + src/value.jl | 3 +++ 3 files changed, 5 insertions(+) diff --git a/REQUIRE b/REQUIRE index 2d2625e3..dfbac391 100644 --- a/REQUIRE +++ b/REQUIRE @@ -2,3 +2,4 @@ julia 0.6 Missings Reexport Compat 0.39.0 +JSON \ No newline at end of file diff --git a/src/CategoricalArrays.jl b/src/CategoricalArrays.jl index 9c547c34..07af518c 100644 --- a/src/CategoricalArrays.jl +++ b/src/CategoricalArrays.jl @@ -18,6 +18,7 @@ module CategoricalArrays if VERSION >= v"0.7.0-DEV.3052" using Printf end + using JSON # FIXME make JSON optional dependency when core Julia will support that include("typedefs.jl") diff --git a/src/value.jl b/src/value.jl index bb28b28f..76ee2296 100644 --- a/src/value.jl +++ b/src/value.jl @@ -160,3 +160,6 @@ Base.match(r::Regex, s::CategoricalString, Base.matchall(r::Regex, s::CategoricalString, overlap::Bool=false) = matchall(r, get(s), overlap) Base.collect(x::CategoricalString) = collect(get(x)) + +# JSON of CatValue is JSON of the value it refers to +JSON.lower(x::CatValue) = get(x)