mirror of
https://github.com/json-iterator/go.git
synced 2024-11-30 08:36:43 +02:00
add convert table
This commit is contained in:
parent
d7b6b4e0bb
commit
e5d7a65616
@ -1,8 +1,7 @@
|
||||
| json type \ dest type | bool | int | uint | string |
|
||||
| --- | --- | --- | --- ||
|
||||
| number | --- | --- | --- ||
|
||||
| string | --- | --- | --- ||
|
||||
| bool | --- | --- | --- ||
|
||||
| bool | --- | --- | --- ||
|
||||
| object | --- | --- | --- ||
|
||||
| array | --- | --- | --- ||
|
||||
| --- | --- | --- | --- |--|
|
||||
| number | positive => true <br/> negative => true <br/> zero => false| 23.2 => 23 <br/> -32.1 => -32| 12.1 => 12 <br/> -12.1 => 12||
|
||||
| string | empty string => false <br/> string "0" => false <br/> other strings => true | "123.32" => 123 <br/> "-123.4" => -123 <br/> "123.23xxxw" => 123 <br/> "abcde12" => 0 <br/> "-32.1" => -32| 13.2 => 13 <br/> -1.1 => 1 ||
|
||||
| bool | true => true <br/> false => false| true => 1 <br/> false => 0 | true => 1 <br/> false => 0 ||
|
||||
| object | true | 0 | 0 ||
|
||||
| array | empty array => false <br/> nonempty array => true| [] => 0 <br/> [1,2] => 1 | [] => 0 <br/> [1,2] => 1 ||
|
@ -14,10 +14,12 @@ var boolConvertMap = map[string]bool{
|
||||
`"true"`: true,
|
||||
`"false"`: true,
|
||||
|
||||
"123": true,
|
||||
"0": false,
|
||||
`"0"`: false,
|
||||
"-1": true,
|
||||
"123": true,
|
||||
`"123"`: true,
|
||||
"0": false,
|
||||
`"0"`: false,
|
||||
"-1": true,
|
||||
`"-1"`: true,
|
||||
|
||||
"1.1": true,
|
||||
"0.0": false,
|
||||
|
Loading…
Reference in New Issue
Block a user