Reputation: 1816
How can I print a value of an object using JSON.stringify() without the curly brackets and quote marks.
For example when I do this:
var string = "this is a string";
var test = JSON.stringify(myJsonObject);
div.innerHTML = test;
the output is this:
{"vavlue":" this is a string"}
How can I output only the actual string without anything else?
i.e :
this is a string
Upvotes: 1
Views: 5151
Reputation: 5249
If your JSON object looks like:
myJsonObject = {"vavlue":" this is a string"};
You don't need to stringify to get the string value, you can use this instead:
myJsonObject.value
Upvotes: 2