-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Allow user to specify integer parsing type * Added a ParserContext object, containing the dicttype and inttype to use for parsing JSON * Use keytype instead of accessing DictType.parameters[1] * four space indent * Rearrange function argument order to put ParserContext first * These are unexported, internal functions, and this ordering makes more sense. * Test inttype=BigInt as well * Update README with `inttype` information.
- Loading branch information
Showing
4 changed files
with
70 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@testset for T in [Int32, Int64, Int128, BigInt] | ||
val = JSON.parse("{\"x\": 3}", inttype=T) | ||
@test isa(val, Dict{String, Any}) | ||
@test length(val) == 1 | ||
key = collect(keys(val))[1] | ||
@test string(key) == "x" | ||
value = val[key] | ||
@test value == 3 | ||
@test typeof(value) == T | ||
end | ||
|
||
@testset begin | ||
teststr = """{"201736327611975630": 18005722827070440994}""" | ||
val = JSON.parse(teststr, inttype=Int128) | ||
@test val == Dict{String,Any}("201736327611975630"=> 18005722827070440994) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters