question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0 in an array is parsed into null

See original GitHub issue

Expected behavior

I’m running into a crucial issue where if I enter this JSON, the “0” in the array turns into null. The expected behavior is that it should remain a “0” and be of type number, as opposed to type null. This appears to be related to #159.

Actual behavior

What actually happens is the the “0” gets turned into a null.

Steps to reproduce the behavior

Simply go to the demo here: https://rawgit.com/json-editor/json-editor/master/docs/demo.html

Paste in the JSON below, and click update form. You’ll find that the 0 has been parsed into null.

{ "array": [ 2, 0, 1 ] }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ghostcommented, Feb 1, 2019

This workaround works for me.

0reactions
schmunk42commented, Jun 11, 2019

I like the idea. Either in the README and/or the wiki (a link to the wiki may be enough).

Read more comments on GitHub >

github_iconTop Results From Across the Web

parsing an array of JSON objects - null value preventing upsert
I am parsing an array of objects, and there's about 12 fields in each. I am doing this with two nested for(var i...
Read more >
Handling JSON null and empty arrays and objects - IBM
Handling null and empty arrays and objects used in JSON data is described. ... data with a null value is parsed into a...
Read more >
Converting JSON into Javascript Objects with JSON.parse()
Revivers convert empty values and complex objects into valid Javascript ... JSON.parse() converts array data into a Javascript array.
Read more >
json parse check the array if it is null or undefined - ServiceNow
Solved: bawiskar Hello All, How can I parse the json and check whether it has null value or 'value' is not added.. e.g.,...
Read more >
Parsing data issue with null value - Power Platform Community
Solved: I am making an HTTP call to an API that returns data which I then use the parseJSON action. The returned data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found