After researching JSON, I began to question what would happen if a JSON path (for instance: foo.bar
) is stored in a variable and then called. Would it call foo.bar
itself, or whatever value is contained within foo.bar
?
Update: I'll provide an example:
var json = { "foo": { "bar": "some value" } };
var container = json.foo.bar;
document.write(contaier);
//Is this equivalent to document.write(json.foo.bar);
//Or is it equivalent to document.write("some value");
//I understand that in this specific scenario, it may not serve any practical purpose, but it could be useful for manipulating the path.