HTML and CSS Reference
In-Depth Information
EXPLANATION
1
The string called jsonString consists of what will represent a JavaScript object
with properties and values. The data in a .json file would not have the outer single
quotes.
2
The JSON.parse() method evaluates the string and converts it to a JavaScript ob-
ject, the same way the JavaScript eval() function works when evaluating an ex-
pression (discussed in “The eval() Function” on page 118).
3
Using the JavaScript object, we can get the name and phone values for the object
with the dot syntax.
Figure 18.21 JSON support with Firefox.
Figure 18.22 Internet Explorer 8: This version does not recognize the JSON parse()
method.
Search WWH ::




Custom Search