Js JSON.parse (how JSON.stringify (item)) avoids turning 0 and 1 into boolean types

JSON.parse (JSON.stringify (item))
this kind of thing, copy an object, as a result, the 0 and 1 in item are automatically lengthened false and true
how to avoid?

the following example:

        console.log("origin", item);
        self.devTypeObj = JSON.parse(JSON.stringify(item))
        console.log("json", JSON.stringify(item));
        console.log("result", self.devTypeObj);

clipboard.png

clipboard.png

JSON.parse 0 1 boolean

clipboard.png

data:

{
    "id": 75,
    "brand": "",
    "model": "ZR250VSD",
    "prol": "GeneralModbusRTU",
    "readInterval": 1,
    "useType": "",
    "iconUrl": null,
    "iotCollItems": [{
        "id": 158,
        "dataLen": 2,
        "isGet": 1,
        "name": "",
        "dataType": "short/10",
        "propertyType": 100,
        "unit": "",
        "valueAddr": 19,
        "valueAddrStr": "0",
        "warnDown": 0,
        "warnUp": 0
    }, {
        "id": 159,
        "dataLen": 2,
        "isGet": 1,
        "name": "",
        "dataType": "short/10",
        "propertyType": 100,
        "unit": "",
        "valueAddr": 19,
        "valueAddrStr": "0",
        "warnDown": 0,
        "warnUp": 0
    }]
}
Dec.08,2021

I tried and didn't find this situation. Can you attach the code

< hr >

can you also give it to the data source? just give it to the future stringify

. < hr >

there is no problem after the test


automatic is impossible. 1 and true are not the same thing in the first place.
you obviously have an exclamation point here, which is another problem with console.log . A snapshot is printed but the reference has been changed.

about console.log , search the site for
https://codeshelper.com/q/10.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4d7ca-44f4d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4d7ca-44f4d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?