EN
Why JSON.parse method does not support undefined property value?
1
answers
2
points
How to make possible to parse json with undefined value?
// ONLINE-RUNNER:browser;
var json = '{"value":undefined}';
var data = JSON.parse(json);
console.log(data);
1 answer
3
points
It is impossible becouse of JSON format.
Try to use null
instead.
// ONLINE-RUNNER:browser;
var json = '{"value":null}';
var data = JSON.parse(json);
console.log(data.value);
Some trick is to do not put value
property.
// ONLINE-RUNNER:browser;
var json = '{}';
var data = JSON.parse(json);
console.log(data.value);
0 comments
Add comment