<!DOCTYPE html>
<html>
<body>
<h2>Creating an Array from JSON</h2>
<p id="demo"></p>
<script>
const myJSON = '[{password:"murali"}]';
const myArray = JSON.parse(myJSON).password;
document.getElementById("demo").innerHTML = myArray;
</script>
</body>
</html>
I need to get murali to get printed. This is for my React Project. I got to validate password. Hence I connected my mysql and retrive password from database and I need to validate it, In oder to validate I need to compare (database Password == input password). But as i retrive password I got the password in [{password: “murali”}] in this format and I am not able to compare with input password.