I have json string and want to get a value by key, but key name is value of some variable. To resolve the issue I've found this

```
window[varName]

```

and tried to use as following

```
<script>
var jsonStr = '{"someProperty":"Value of someProperty","somePropertyAndSuffix":"Value of somePropertyAndSuffix"}';
var jsonObj = JSON.parse(jsonStr);

var propAsString = 'someProperty';

console.log(jsonObj.window[propAsString]);
console.log(jsonObj.window[propAsString]+'AndSuffix');
</script>

```

but I get the error

> 
> Uncaught TypeError: Cannot read property 'someProperty' of undefined
> 
> 
> 

If I try

```
console.log(jsonObj[window[propAsString]]);
console.log(jsonObj[window[propAsString]+'AndSuffix']);

```

I get two `undefined`