0

This is not a valid JSON data. But I have to parse it to extract "isNavPaneDisabled". How do I parse it?

var text = {
    version: "1.8",
    viewid: "RegistrationPage",
    browserless: false,
    username: "system",
    userrole: "NonAdmin",
    message: "",
    productname: "someApp",
    isNavPaneDisabled: true,
    isDebug: false
};
1
  • 5
    Why parse? This is JS var. Use it as is: text.isNavPaneDisabled Commented Jan 31, 2015 at 8:04

1 Answer 1

3

The following object isn't in JSON format, but still it's a javaScript object.

console.log(typeof text); // it says text is an object

So you can access the properties of that object. In your case try,

console.log(text.isNavPaneDisabled);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.