I'm having trouble importing JSON in the way I expect, based on my reading of the documentation. The particular issue I'm having is with importing a specific element, or list of elements. From the doc:
Import["file.json", "elem"]
imports the specified element from a JSON file.
To test this, I'm trying the following:
In[1]:= Export["out.json", {"x"->42,"y"->17.5}]
Out[1]= out.json
The resulting file looks like:
{"x" : 42,
"y" : 17.5}
Importing the entire file works, returning a list of rules:
In[2]:= Import["out.json"]
Out[2]= {x -> 42, y -> 17.5}
But, importing a specific element fails:
In[3]:= Import["out.json", "x"]
Import::noelem: The Import element "x" is not present when importing as JSON.
Out[3]= $Failed
What am I missing? Perhaps "element" doesn't mean what I think it means?
Import["out.json", {"Data", "x"}]
? $\endgroup$