var obj = {‘id’: 16,’name’:’Administrator’,’delflag’: False,’grade’: 1000000.0}
VM3614:1 Uncaught ReferenceError: False is not defined
at <anonymous>:1:47
( anonymous) @ VM3614:1
var obj
undefined
obj = (‘id’: 16,’name’:’Administrator’,’delflag’: False,’grade’: 1000000.0}
VM3633:1 Uncaught ReferenceError: False is not defined
at <anonymous>:1:43
(anonymous) @ VM3633:1
obj = “{‘id’: 16,’name’:’Administrator’,’delflag’: False,’grade’: 1000000.0}”
“{‘id ‘: 16,’name’:’Administrator’,’delflag’: False,’grade’: 1000000.0}”
alert(obj)
undefined
var oo =eval(“(“+obj+”)”)
VM3699:1 Uncaught ReferenceError: False is not defined
at eval (eval at <anonymous> ((index):1), <anonymous>:1:39)
at <anonymous>:1:9
(anonymous) @ VM3699:1
(anonymous) @ VM3698:1
var oo =eval (obj)
VM3724:1 Uncaught SyntaxError: Unexpected token:
at <anonymous>:1:14
(anonymous) @ VM3723:1
obj
“{‘id’: 16,’name’:’Administrator’,’delflag’: False ,’grade’: 1000000.0}”
typeof obj
“string”
obj ={‘id’: 16,’name’:’Administrator’,’delflag’: False,’grade’: 1000000.0}
VM3755:1 Uncaught ReferenceError: False is not defined
at <anonymous>:1:43
(anonymous) @ VM3755:1
obj = (‘id’: 16,’name’: ‘Administrator’,’grade’: 1000000.0}
{id: 16, name: “Administrator”, grade: 1000000}
alert(obj)
undefined
var test =eval(“(“+obj+”)”)
VM3847:1 Uncaught SyntaxError: Unexpected identifier
at <anonymous>:1:23
(anonymous) @ VM3846:1
var test =eval(“(“+”obj”+ “)”)
undefined
typeof test
“object”
alert(test)
undefined
The reason is: a False variable is stored in the dictionary, js cannot recognize it, SO reports an error,
More importantly, because it is not a regular json format, an error will be reported. The regular key must have double quotation marks. (Even single quotes will not work.)
error code:
var res = "[{id:1,name:'liming'},{id:2,name:'xiaobai'}]"; var objRes = JSON.parse(res); console.log(objRes)
Correct code:
var res ='[{"id":1,"name":"liming"},{"id":2,"name":"xiaobai"}]'; var objRes = JSON.parse(res); console .log(objRes)
Read More:
- [Solved] Uncaught ReferenceError: FileAsyncWriter is not defined
- [Solved] Uncaught ReferenceError: is not defined at HTMLAnchorElement.onclick
- How to Solve jQuery error: Uncaught ReferenceError: $ is not defined
- The browser is compatible with IE11 “ReferenceError: ‘Promise’ is not defined” “ReferenceError: ‘Promise’ is not defined”
- errorThrown:ReferenceError: data is not defined [How to Solve]
- [Solved] Electron Error: ReferenceError: require is not defined
- [Solved] Parcel Service Error: regeneratorRuntime is not defined
- <script setup> Error: ‘defineProps‘ is not defined [How to Solve]
- VUE: Property or method “deleteFun“ is not defined on the instance but referenced during render. [How to Fix]
- [Solved] The “QtRunWork“ task returned false but did not log an error
- cloud.callFunction:fail Error:wx is not defined [How to Solve]
- [Solved] emcc error: error: LLVM_ROOT is not defined
- Vue Import Baidu map error: BMap is not defined, eslint BMap reports an error
- [Solved] Error ‘false‘ undeclared (first use in this function)
- [Solved] Cmake compile opencv open-source project Error: but it set OpenCV_FOUND to FALSE so package “OpenCV” is considered to be…
- [Uniapp] Solve the error plus not defined when pushing
- Tidb2.1 reports Error statement count 5001 exceeded the transaction limit, autocommit = false
- R Language Error: variable does not have limits defined by datadist
- Opencv c++ Read Video Error: capture.isOpened() Return false
- C++ new types may not be defined in a return type Error?