Skip to content

Commit

Permalink
Updates to documentation and README
Browse files Browse the repository at this point in the history
  • Loading branch information
lwabeke committed Apr 17, 2020
1 parent 59dedb4 commit 98e3cd4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,21 @@ Unmarshal.unmarshal(Array{Float64}, JSON.parse(jstring))
# [ 1.0 ; 1.0 ; 1.0 ]
```

```julia
using LazyJSON

#"[1.0,1.0,1.0]"

Unmarshal.unmarshal(Array{Float64}, JSON.parse(jstring))
#3-element Array{Float64,1}:
# [ 1.0 ; 1.0 ; 1.0 ]
```

## Documentation

```julia
Unmarshal.unmarshal(MyType, parseOutput, verbose = false )
```
Builds on object of type :MyType from the dictionary produced by JSON.parse. Set verbose to true to get debug information about the type hierarchy beging unmarshalled. This might be useful in tracking down mismatches between the JSON object and the Julia type definition.
Builds on object of type :MyType from the dictionary produced by JSON.parse or now also LazyJSON.parse. Set verbose to true to get debug information about the type hierarchy beging unmarshalled. This might be useful in tracking down mismatches between the JSON object and the Julia type definition.


11 changes: 10 additions & 1 deletion src/Unmarshal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ unmarshal(::Type{Array}, xs::Union{Vector,AbstractArray}, verbose :: Bool = fals
"""
unmarshal(T, dict[, verbose[, verboselvl]])
Reconstructs an object of Type T using the dictionary output of a `JSON.parse.`
Reconstructs an object of Type T using the dictionary output of a `JSON.parse` or now 'LazyJSON.parse`.
Set verbose `true` to get debug information about how the data hierarchy is unmarshalled. This might be useful to track down parsing errors and/or mismatches between the JSON object and the Type definition.
Expand All @@ -83,6 +83,15 @@ julia> var = randn(Float64, 5); # Should work for most other variations of type
julia> unmarshal(typeof(var), JSON.parse(JSON.json(var)) ) == var
true
or
julia> using LazyJSON
julia> var = randn(Float64, 5); # Should work for most other variations of types you can think of
julia> unmarshal(typeof(var), LazyJSON.parse(JSON.json(var)) ) == var
true
```
"""
Expand Down

0 comments on commit 98e3cd4

Please sign in to comment.