Does JSON treat these all the same? Or are they a mix of Integers and booleans?
var data = { "zero" : 0, "one" : 1, "false" : 0, "true" : 1, "0" : false, "1" : true }
JSON BooleansValues in JSON can be true/false.
JSON does not have distinct types for integers and floating-point values. Therefore, the presence or absence of a decimal point is not enough to distinguish between integers and non-integers. For example, 1 and 1.0 are two ways to represent the same value in JSON.
JSON numbers follow JavaScript's double-precision floating-point format. Represented in base 10 with no superfluous leading zeros (e.g. 67, 1, 100). Include digits between 0 and 9. Can be a negative number (e.g. -10 .
The boolean type matches only two special values: true and false . Note that values that evaluate to true or false , such as 1 and 0, are not accepted by the schema.
The values true
and false
are actual boolean values, the rest are integers. See http://json.org/ for more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With