Does Not Parse Boolean/Number in array
See original GitHub issueConsider this code
Qs.stringify({
field: {
$in: [true, false,0,1]
}
})
true, false, 0, 1
all become strings
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Boolean.parseBoolean not working - Stack Overflow
When I read the array the string array (parts) says that parts[0]=true;. ,but when I use Boolean.parseBoolean array[0] is still false.
Read more >2 Ways to Convert Values to Boolean in JavaScript
The first ! coerce the value to a boolean and inverse it. In this case, !value will return false . So to reverse...
Read more >JSON.stringify() - JavaScript - MDN Web Docs
A function that alters the behavior of the stringification process, or an array of strings and numbers that specifies properties of value to...
Read more >Convert.ToBoolean Method (System) - Microsoft Learn
Returns the specified Boolean value; no actual conversion is performed. ... The following example converts an array of SByte values to Boolean values....
Read more >Types – Liquid template language - Shopify
String; Number; Boolean; Nil; Array; EmptyDrop. You can initialize Liquid variables ... Liquid does not convert escape sequences into special characters.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
parse
is expected to produce something that’s not a string, butstringify
is not.Separately,
qs.parse
does not in fact do that in my testing:etc.
@dmitry that’s because
parse
only accepts a string. Passing a boolean in is a type error, something that I’ll probably make throw an exception in the next semver-major, whenever that is.Regarding #91,
a=true
in a query string is the string “true”, not a boolean, soqs
won’t ever do the wrong thing there by default. You’ll have to use a custom decoder if you want nonstandard types.